Class PathHelpers
Static class with additional helper methods for interacting with paths.
Inheritance
Namespace: Cireson.Core.Common.Helpers
Assembly: Cireson.Core.Common.dll
Syntax
public static class PathHelpers : object
Remarks
Admin, 8/24/2017.
Methods
View SourceCleanupVirtualPath(String)
Removes ~/ and replaces / with \ and removes drive letter if it exists.
Declaration
public static string CleanupVirtualPath(string virtualPath)
Parameters
Type | Name | Description |
---|---|---|
System.String | virtualPath | . |
Returns
Type | Description |
---|---|
System.String | A string. |
Remarks
Admin, 8/24/2017.
GetParentDirectories(String)
Returns an enumeration of all parent directories in a given path, ie:
Declaration
public static IEnumerable<string> GetParentDirectories(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | . |
Returns
Type | Description |
---|---|
IEnumerable<System.String> | An enumerator that allows foreach to be used to process the parent directories in this collection. |
Remarks
Admin, 8/24/2017.
IsPathInContentRoot(String, String)
Indicates if the virtual path is inside the contentRoot.
Declaration
public static bool IsPathInContentRoot(string virtualPath, string contentRoot)
Parameters
Type | Name | Description |
---|---|---|
System.String | virtualPath | . |
System.String | contentRoot | . |
Returns
Type | Description |
---|---|
System.Boolean | True if path in content root, false if not. |
Remarks
Admin, 8/24/2017.
ReroutePathToDefaultRootPath(String, String)
Reroutes the path to default root path.
Declaration
public static string ReroutePathToDefaultRootPath(string virtualPath, string contentRoot)
Parameters
Type | Name | Description |
---|---|---|
System.String | virtualPath | The virtual path. |
System.String | contentRoot | The content root path. |
Returns
Type | Description |
---|---|
System.String | System.String. |
Remarks
This can be used to reroute paths to look like they represent paths from the application root. eg: A Platform Extension may store all it's content files in a path called /content/root/index.html but at runtime, the developer wants to use /index.html.