Class PathUtility
A utility class for executing path-related operations.
Namespace: Unity.AnimeToolbox
Syntax
public static class PathUtility
Methods
GenerateUniqueFolder(String)
Generate a unique folder by trying with the passed parameter as the first candidate. "/foo/bar": will generate "/foo/bar" if the directory didn't exist. "/foo/bar": will generate "/foo/bar 1"" if the directory already existed.
Declaration
public static string GenerateUniqueFolder(string folder)
Parameters
Type | Name | Description |
---|---|---|
String | folder | The first candidate of the folder to create |
Returns
Type | Description |
---|---|
String | The path to the created folder |
GetDirectoryName(String, Int32)
Get the directory name of the path n-levels up Ex: n=1. Assets/Scripts/Foo.cs => Assets/Scripts n=2. Assets/Scripts/Foo.cs => Assets
Declaration
public static string GetDirectoryName(string path, int n = 1)
Parameters
Type | Name | Description |
---|---|---|
String | path | the base path |
Int32 | n | how many levels up |
Returns
Type | Description |
---|---|
String | the directory name |