Skip to main content

PathUtils

Assembly: ServiceStack.Text.dll​
View Source​
Declaration
public static class PathUtils

Methods​

MapAbsolutePath(String, String)​

View Source​
Declaration
public static string MapAbsolutePath(this string relativePath, string appendPartialPathModifier)
Returns​

System.String

Parameters​
TypeName
System.StringrelativePath
System.StringappendPartialPathModifier

MapProjectPath(String)​

Maps the path of a file in the context of a VS project in a Console App

Assumes static content is two directories above the /bin/ directory, eg. in a unit test scenario the assembly would be in /bin/Debug/.

View Source​
Declaration
public static string MapProjectPath(this string relativePath)
Returns​

System.String: the absolute path Assumes static content is two directories above the /bin/ directory, eg. in a unit test scenario the assembly would be in /bin/Debug/.

Parameters​
TypeNameDescription
System.StringrelativePaththe relative path

Assumes static content is two directories above the /bin/ directory, eg. in a unit test scenario the assembly would be in /bin/Debug/. |

MapProjectPlatformPath(String)​

Maps the path of a file in the context of a VS 2017+ multi-platform project in a Console App

Assumes static content is two directories above the /bin/ directory, eg. in a unit test scenario the assembly would be in /bin/Debug/net45

View Source​
Declaration
public static string MapProjectPlatformPath(this string relativePath)
Returns​

System.String: the absolute path Assumes static content is two directories above the /bin/ directory, eg. in a unit test scenario the assembly would be in /bin/Debug/net45

Parameters​
TypeNameDescription
System.StringrelativePaththe relative path

Assumes static content is two directories above the /bin/ directory, eg. in a unit test scenario the assembly would be in /bin/Debug/net45 |

MapAbsolutePath(String)​

Maps the path of a file in the bin\ folder of a self-hosted scenario

Assumes static content is copied to /bin/ folder with the assemblies

View Source​
Declaration
public static string MapAbsolutePath(this string relativePath)
Returns​

System.String: the absolute path Assumes static content is copied to /bin/ folder with the assemblies

Parameters​
TypeNameDescription
System.StringrelativePaththe relative path

Assumes static content is copied to /bin/ folder with the assemblies |

MapHostAbsolutePath(String)​

Maps the path of a file in an ASP.NET hosted scenario

Assumes static content is in the parent folder of the /bin/ directory

View Source​
Declaration
public static string MapHostAbsolutePath(this string relativePath)
Returns​

System.String: the absolute path Assumes static content is in the parent folder of the /bin/ directory

Parameters​
TypeNameDescription
System.StringrelativePaththe relative path

Assumes static content is in the parent folder of the /bin/ directory |

AppendPaths(StringBuilder, String[])​

View Source​
Declaration
public static void AppendPaths(StringBuilder sb, string[] paths)
Parameters​
TypeName
System.Text.StringBuildersb
System.String[]paths

CombinePaths(String[])​

View Source​
Declaration
public static string CombinePaths(params string[] paths)
Returns​

System.String

Parameters​
TypeName
System.String[]paths

AssertDir(String)​

Create Directory if not exists

View Source​
Declaration
public static string AssertDir(this string dirPath)
Returns​

System.String

Parameters​
TypeName
System.StringdirPath

AssertDir(DirectoryInfo)​

Create Directory if not exists

View Source​
Declaration
public static string AssertDir(this DirectoryInfo dirInfo)
Returns​

System.String

Parameters​
TypeName
System.IO.DirectoryInfodirInfo

AssertDir(FileInfo)​

Create Directory if not exists

View Source​
Declaration
public static string AssertDir(this FileInfo fileInfo)
Returns​

System.String

Parameters​
TypeName
System.IO.FileInfofileInfo

CombineWith(String, String)​

View Source​
Declaration
public static string CombineWith(this string path, string withPath)
Returns​

System.String

Parameters​
TypeName
System.Stringpath
System.StringwithPath

CombineWith(String, String[])​

View Source​
Declaration
public static string CombineWith(this string path, params string[] thesePaths)
Returns​

System.String

Parameters​
TypeName
System.Stringpath
System.String[]thesePaths

CombineWith(String, Object[])​

View Source​
Declaration
public static string CombineWith(this string path, params object[] thesePaths)
Returns​

System.String

Parameters​
TypeName
System.Stringpath
System.Object[]thesePaths

ResolvePaths(String)​

View Source​
Declaration
public static string ResolvePaths(this string path)
Returns​

System.String

Parameters​
TypeName
System.Stringpath

ToStrings(Object[])​

View Source​
Declaration
public static string[] ToStrings(object[] thesePaths)
Returns​

System.String[]

Parameters​
TypeName
System.Object[]thesePaths