Nerves v1.3.2 Nerves.Utils.WSL View Source
This module contains utility functions to assist in detecting a Windows Subsystem for Linux environment as well as functions to convert paths between the Windows host and Linux.
Link to this section Summary
Functions
Returns a two item tuple where the first item is a command and the second is the argument list to run a powershell command as administrator in Windows
If the file was created in a temporary location, get the WSL path and delete it. Otherwise return :ok
Executes wslpath with the file and arguments
Gets a list of fwup devices on a Windows host. This function can be run from within WSL, as it runs a powershell command to get the list and writes it to a temporary file that WSL can access
Returns a path to the base file name a temporary location in Windows
Returns a two item tuple containing the Windows host path for a file and its WSL counterpart
Returns true if the WSL utility wslpath
is available
Returns an item tuple with the Windows accessible path and whether the path is a temporary location or original location
Returns true if the path is accessible in Windows
Returns true if inside a WSL shell environment
Returns true when the path starts with a drive letter, colon and either single backslash or double backslash
Returns true if the path is not a Windows path
Link to this section Functions
Returns a two item tuple where the first item is a command and the second is the argument list to run a powershell command as administrator in Windows
If the file was created in a temporary location, get the WSL path and delete it. Otherwise return :ok
Executes wslpath with the file and arguments.
When a valid WSL path is passed through to wslpath
asking for a
valid path an “Invalid argument” error is returned. This function
catches this error and returns the valid path.
Gets a list of fwup devices on a Windows host. This function can be run from within WSL, as it runs a powershell command to get the list and writes it to a temporary file that WSL can access.
Returns a path to the base file name a temporary location in Windows
Returns a two item tuple containing the Windows host path for a file and its WSL counterpart.
If the path is not available in either Windows or WSL, nil will replace the item
Examples
iex> Nerves.Utils.WSL.get_wsl_paths("mix.exs", Nerves.Utils.WSL.has_wslpath?())
{"C:\Users\username\src\nerves\mix.exs",
"/mnt/c/Users/username/src/nerves/mix.exs"}
Returns true if the WSL utility wslpath
is available
Returns an item tuple with the Windows accessible path and whether the path is a temporary location or original location
Returns true if the path is accessible in Windows
Returns true if inside a WSL shell environment
Returns true when the path starts with a drive letter, colon and either single backslash or double backslash
Returns true if the path is not a Windows path