Class MetaFilePathUtil
Namespace: Workspace.XBR.Xperiflow.MetaFileSystem
Assembly: Xperiflow.dll
public static class MetaFilePathUtil
Methods
JoinParentAndName(string, string, bool)
Joins a parent and name with a joiner.
public static string JoinParentAndName(string parent, string name, bool asPosix = true)
Returns
System.String
The joined parent and name.
Parameters
| Type | Name | Description |
|---|---|---|
System.String | parent | The parent to join. |
System.String | name | The name to join. |
System.Boolean | asPosix |
PathAsPosix(string)
Returns the path in posix format (forward slashes). This ensures that all paths are used with forward slashes.
public static string PathAsPosix(string path)
Returns
System.String
The path as posix.
Parameters
| Type | Name | Description |
|---|---|---|
System.String | path | The path to convert. |
PathAsWindows(string)
Returns the path in windows format (backward slashes). This ensures that all paths are used with backward slashes.
public static string PathAsWindows(string path)
Returns
System.String
Parameters
| Type | Name |
|---|---|
System.String | path |
SanitizePath(string, bool)
Removes any duplicate slashes from the path and standardizes the path to have consistent slashes based on the asPosix parameter.
public static string SanitizePath(string path, bool asPosix = true)
Returns
System.String
Parameters
| Type | Name |
|---|---|
System.String | path |
System.Boolean | asPosix |
GetPathParent(string, bool)
Returns the parent of a path.
public static string GetPathParent(string path, bool asPosix = true)
Returns
System.String
The parent of the path.
Parameters
| Type | Name | Description |
|---|---|---|
System.String | path | The path to get the parent of. |
System.Boolean | asPosix | Whether to return the path as posix. |
GetPathName(string)
Returns the last part of the path.
public static string GetPathName(string path)
Returns
System.String
The last portion of the path.
Parameters
| Type | Name | Description |
|---|---|---|
System.String | path | The path to get the name of. |
GetPathParentAndName(string, bool)
Returns the parent and name of a path.
public static (string, string) GetPathParentAndName(string path, bool asPosix = true)
Returns
System.ValueTuple<System.String,System.String>
The parent and name of the path.
Parameters
| Type | Name | Description |
|---|---|---|
System.String | path | The path to get the parent and name of. |
System.Boolean | asPosix | Whether to return the path as posix. |
JoinPathParts(bool, params string[])
Joins paths together.
public static string JoinPathParts(bool asPosix = true, params string[] pathParts)
Returns
System.String
The joined paths.
Parameters
| Type | Name | Description |
|---|---|---|
System.Boolean | asPosix | Whether to format the joined path as POSIX, using forward slashes. Defaults to true. False will return windows paths. |
System.String[] | pathParts | The paths to join. |
GetPathExtendedSuffix(string, bool)
Returns the extension of a path, including compound extensions.
public static string GetPathExtendedSuffix(string path, bool includePeriod = true)
Returns
System.String
The extension of the path.
Parameters
| Type | Name | Description |
|---|---|---|
System.String | path | The path to get the extension of. |
System.Boolean | includePeriod | Whether to include the leading period in the returned extension. |
GetPathParts(string, bool)
Returns the parts of a path.
public static string[] GetPathParts(string path, bool asPosix = true)
Returns
System.String[]
The parts of the path.
Parameters
| Type | Name | Description |
|---|---|---|
System.String | path | The path to get the parts of. |
System.Boolean | asPosix | Whether to return the path as posix. Defaults to true. |
GetRelativePath(string, string, bool)
Gets the relative path from a full path to a root path, with an option to format as POSIX.
public static string GetRelativePath(string fullPath, string rootPath, bool asPosix = true)
Returns
System.String
The relative path from the root path to the full path.
Parameters
| Type | Name | Description |
|---|---|---|
System.String | fullPath | The full path to get the relative path from. |
System.String | rootPath | The root path to calculate the relative path to. |
System.Boolean | asPosix | Whether to return the path in POSIX format. Default is true. |
Exceptions
OneStream.Shared.Common.XFException
Thrown when the fullPath does not contain the rootPath.
Inherited Members
System.Object.Equals(System.Object)System.Object.Equals(System.Object,System.Object)System.Object.GetHashCodeSystem.Object.GetTypeSystem.Object.MemberwiseCloneSystem.Object.ReferenceEquals(System.Object,System.Object)System.Object.ToString