Class FilePathHelper
- Namespace
- Dynamicweb.Core.Helpers
- Assembly
- Dynamicweb.Core.dll
public static class FilePathHelper
- Inheritance
-
FilePathHelper
- Inherited Members
Methods
GetAbsolutePath(string)
Gets absolute path
public static string GetAbsolutePath(string path)
Parameters
pathstringThe path value. Could be relative or filename
Returns
GetAbsolutePath(string, string?)
Gets absolute path
public static string GetAbsolutePath(string path, string? defaultFolder)
Parameters
pathstringThe path value. Could be relative or filename
defaultFolderstringThe folder path added to relative path in case the value is need to be corrected.
Returns
GetRelativePath(string)
Gets correct relative path
public static string GetRelativePath(string path)
Parameters
pathstringThe path value. Could be relative or absolute or filename
Returns
GetRelativePath(string, string?)
Gets correct relative path
public static string GetRelativePath(string path, string? defaultFolder)
Parameters
pathstringThe path value. Could be relative or absolute or filename
defaultFolderstringThe folder path added to relative path in case the value is need to be corrected.
Returns
GetValidFileOrFolderName(string)
Sanitizes the given file or folder name, and replaces all illegal characters with '_'
public static string? GetValidFileOrFolderName(string name)
Parameters
namestringThe file or folder name which should be sanitized.
Returns
- string
The sanitized file or folder name which only contains legal characters
IsUrl(string)
public static bool IsUrl(string path)
Parameters
pathstring
Returns
ValidateFilename(string)
Validates the given filename with path.
public static bool ValidateFilename(string fileNameWithPath)
Parameters
fileNameWithPathstringThe filename with path to validate
Returns
- bool
trueif filename and path is valid;falseotherwise.