PathUtils
Assembly: ServiceStack.Text.dll
View Source
public static class PathUtils
Methods
MapAbsolutePath(String, String)
View Source
public static string MapAbsolutePath(this string relativePath, string appendPartialPathModifier)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | relativePath |
System.String | appendPartialPathModifier |
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
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
Type | Name | Description |
---|---|---|
System.String | relativePath | the 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
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
Type | Name | Description |
---|---|---|
System.String | relativePath | the 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
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
Type | Name | Description |
---|---|---|
System.String | relativePath | the 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
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
Type | Name | Description |
---|---|---|
System.String | relativePath | the relative path |
Assumes static content is in the parent folder of the /bin/ directory |
AppendPaths(StringBuilder, String[])
View Source
public static void AppendPaths(StringBuilder sb, string[] paths)
Parameters
Type | Name |
---|---|
System.Text.StringBuilder | sb |
System.String[] | paths |
CombinePaths(String[])
View Source
public static string CombinePaths(params string[] paths)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String[] | paths |
AssertDir(String)
Create Directory if not exists
View Source
public static string AssertDir(this string dirPath)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | dirPath |
AssertDir(DirectoryInfo)
Create Directory if not exists
View Source
public static string AssertDir(this DirectoryInfo dirInfo)
Returns
System.String
Parameters
Type | Name |
---|---|
System.IO.DirectoryInfo | dirInfo |
AssertDir(FileInfo)
Create Directory if not exists
View Source
public static string AssertDir(this FileInfo fileInfo)
Returns
System.String
Parameters
Type | Name |
---|---|
System.IO.FileInfo | fileInfo |
CombineWith(String, String)
View Source
public static string CombineWith(this string path, string withPath)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | path |
System.String | withPath |
CombineWith(String, String[])
View Source
public static string CombineWith(this string path, params string[] thesePaths)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | path |
System.String[] | thesePaths |
CombineWith(String, Object[])
View Source
public static string CombineWith(this string path, params object[] thesePaths)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | path |
System.Object[] | thesePaths |
ResolvePaths(String)
View Source
public static string ResolvePaths(this string path)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | path |
ToStrings(Object[])
View Source
public static string[] ToStrings(object[] thesePaths)
Returns
System.String[]
Parameters
Type | Name |
---|---|
System.Object[] | thesePaths |