Table of Contents

Class FileSystemUtils

Namespace
Xarial.XToolkit
Assembly
BlueByte.SOLIDWORKS.PDMProfessional.SDK.dll
public static class FileSystemUtils
Inheritance
FileSystemUtils
Inherited Members

Methods

BrowseFileInExplorer(string)

Opens file explorer and selects specified file

public static void BrowseFileInExplorer(string path)

Parameters

path string

BrowseFolderInExplorer(string)

Opens file explorer at the specified folder

public static void BrowseFolderInExplorer(string path)

Parameters

path string

CombinePaths(string, params string[])

Combines the directory paths

public static string CombinePaths(string srcPath, params string[] additionalPaths)

Parameters

srcPath string

Start path

additionalPaths string[]

Additional path parts

Returns

string

Combined path

Remarks

This method works with relative path, including moving the upper folders via ..

GetRelativePath(string, string)

Finds the relative path

public static string GetRelativePath(string thisPath, string relativeToDir)

Parameters

thisPath string

Path to get relative path for

relativeToDir string

Relative directory

Returns

string

Relative path

Exceptions

Exception

GetTopFolders(IEnumerable<string>)

Excludes all sub level folders and only returns top level folders

public static string[] GetTopFolders(IEnumerable<string> paths)

Parameters

paths IEnumerable<string>

Input directory paths

Returns

string[]

Top level folders paths

IsInDirectory(string, string)

Checks if the specified path is in the other directory

public static bool IsInDirectory(string thisPath, string parentDir)

Parameters

thisPath string

Path to check

parentDir string

Directory to check agains

Returns

bool

True of directory is within another directory

ReplaceIllegalRelativePathCharacters(string, Func<char, char>)

Replaces illegal characters in the relative file path (rooted path is not supported)

public static string ReplaceIllegalRelativePathCharacters(string path, Func<char, char> replacer)

Parameters

path string

Input path

replacer Func<char, char>

Illegal characters replacer

Returns

string

Legal file path