项目作者: jfcameron

项目描述 :
Convert WSL path to native windows path
高级语言: Shell
项目地址: git://github.com/jfcameron/winpath.git
创建时间: 2019-03-21T23:33:09Z
项目社区:https://github.com/jfcameron/winpath

开源协议:BSD 2-Clause "Simplified" License

下载


Winpath

Description

Converts a POSIX path within the filesystem of a linux installation on win10’s linux subsystem to a native path within the host filesystem.

Supports symbolic links

Supports paths through /mnt/*/

Usage

Set the following variable in your bash profile:

  1. export JFC_WINPATH_FS_ROOT="C:\path\to\linuxfs"

then refer to winpath.sh -h:

  1. #---------------------------------------------------------------------
  2. #
  3. # winpath.sh -- help info
  4. #
  5. # Summary:
  6. # Converts a posix path within a linux installation on the linux submodule of win10 to
  7. # a native path within the host filesystem.
  8. # supports symbolic links
  9. # supports paths through /mnt/*/ e.g: mnt/c converts to c:\ and so on
  10. #
  11. # Example Usage:
  12. # winpath.sh
  13. # winpath.sh Workspace/glfw
  14. #
  15. # winpath.sh: [ -h {path} ]
  16. # option: -h
  17. # print this help page
  18. #
  19. # option: NONE
  20. # echoes the conversion of pwd
  21. #
  22. # option: {path}
  23. # echoes the conversion of the given {path}
  24. #
  25. # Config:
  26. # JFC_WINPATH_FS_ROOT: the windows path to the root of your linux installation's filesystem
  27. #
  28. # Author:
  29. # Written by Joseph Cameron | jfcameron.github.io
  30. # Created on 2019-03-31.
  31. #
  32. #---------------------------------------------------------------------

example uses:

$explorer.exe $(winpath.sh) : this would open the current directory in ms explorer

$code.exe $(winpath.sh main.c) : this would open main.c in vs code

consider adding winpath to your path for the most convenience.