remote_path

Function remote_path 

Source
pub fn remote_path(path: &str, path_type: PathType) -> Result<String>
Expand description

Convert local mounted filesystem path to Windows/Linux UNC path

Parameters:

  • path - local filesystem path
  • path_type - destination UNC path type

Returns: UNC path wrapped with crate::Result

§Example

let path = "/mnt/mynas/some/path";
let res = unctool::remote_path(path, unctool::PathType::Windows).unwrap();
assert_eq!(res, r"\\mynas\some\path");

§Errors

Function will return Error::RemotePathNotFound if remote share is not found for this path

let path = r"/mnt/no-such-share";
let res = unctool::remote_path(path, unctool::PathType::Windows);
assert_eq!(res, Err(unctool::Error::RemotePathNotFound));