Table of Contents

Class PathUtils

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

Contains Path related static methods.

public static class PathUtils
Inheritance
PathUtils

Properties

TempPathOverride

Gets or sets the override path for the temporary folder returned by GetTempPath().

UseAppSubFolderAsTempPath

Gets or sets a value indicating whether the application should use a subfolder within the application folder as the temporary path.

Methods

AddDirectorySeparatorChar(string?)

Adds directory separator char to the path if it's needed. If path already has directory separator char at the end, no changes are performed.

CompareByFileName(string, string)

Compares two specified paths by file name and returns an integer that indicates their relative position in the sort order.

CreateExecutingAssemblyWithNewExt(string, string)

Creates file with the path and name of the executing assembly and with the specified extension.

DirectoryHasEntries(string)

Gets whether directory is not empty (contains files or sub-folders).

DirectoryIsEmpty(string)

Gets whether directory is empty (contains no files or sub-folders).

EndsWithDirectorySeparator(string?)

Returns boolean value indicating whether path ends with directory separator char.

ExtractDirectorySeparatorChar(string?)

Returns directory separator char which is used in given path.

GenFilePathOnDesktop(string, bool)

Generates a file path on the desktop for the specified file name.

GenTempFileName(string, GenTempFileNameFlags)

Generates a temporary file name with the specified extension.

GenerateUniqueFilename(string, string)

Generates a unique file name in the specified folder based on the provided file name template.

GenerateUniqueFilenameInDownloads(string)

Generates a unique filename in the user's Downloads folder based on the specified filename template.

GetAppFolder()

Returns path to the application folder.

GetAppSubFolder(string, bool)

Gets sub-folder path in the application folder.

GetDesktopPath()

Gets the path to the desktop directory for the current user.

GetDownloadsPath()

Gets the path to the user's Downloads folder.

GetExecutingAssemblyWithNewExt(string)

Gets file path and name of the executing assembly with the specified extension.

GetExtensionLower(string?)

Returns the extension of a file path in the lower case without leading period.

GetFullPath(string, string)

Returns an absolute path from a relative path and a fully qualified base path.

GetTempAppSubFolder()

Gets path to the 'Temp' sub-folder of the application folder.

GetTempFileName()

Generates a temporary file name in the temporary directory returned by GetTempPath().

GetTempPath()

Returns the path to the temporary folder.

GetTempPathSubFolder(string?)

Returns a subfolder path inside the system temporary directory.

GetTempPathUniquePerApp(string?)

Generates a unique temporary path for the application.

GetTempPathWithAlternet()

Gets the full path to a temporary subdirectory named 'Alternet' within the system's temporary folder.

HasExtension(string?, string, StringComparison)

Checks if the specified path has the given file extension.

PopDirectory()

Restores current directory path previously saved with PushDirectory(string). This method does the same as console command "popd".

PushDirectory(string)

Saves current directory path to memory and changes it to the specified path. Use PopDirectory() to restore saved folder. This method does the same as console command "pushd".

RemoveExecutingAssemblyWithExt(string)

Removes file with path and name of the executing assembly with the specified extension.

ResetTempPathUniquePerApp()

Resets the temporary path configuration to use a unique subfolder for the current application.