File tree Expand file tree Collapse file tree 2 files changed +20
-6
lines changed
Assets/JCSUnity/Scripts/Util
docs/ScriptReference/Util Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -58,9 +58,22 @@ public static string Combine(params string[] list)
5858 ///
5959 /// The returned string should start with `Assets/`.
6060 /// </summary>
61- public static string ToAsset ( string path )
61+ public static string ToAssetPath ( string path )
6262 {
6363 return path . Replace ( Application . dataPath , "Assets" ) ;
6464 }
65+
66+ /// <summary>
67+ /// Convert an asset path to data path.
68+ ///
69+ /// This returns an absolute full path.
70+ /// </summary>
71+ public static string ToDataPath ( string path )
72+ {
73+ if ( path . StartsWith ( Application . dataPath ) )
74+ return path ;
75+
76+ return Combine ( Application . dataPath , path ) ;
77+ }
6578 }
6679}
Original file line number Diff line number Diff line change 22
33The utility module for handling path issues.
44
5- | Name | Description |
6- | :----------| :----------------------------------------------------------|
7- | Normalize | Return the normalized path. |
8- | Combine | Safe way to combine multiple path to one path with slash. |
9- | ToAsset | Convert a path to asset compatible path. |
5+ | Name | Description |
6+ | :------------| :----------------------------------------------------------|
7+ | Normalize | Return the normalized path. |
8+ | Combine | Safe way to combine multiple path to one path with slash. |
9+ | ToAssetPath | Convert a path to asset compatible path. |
10+ | ToDataPath | Convert an asset path to data path. |
You can’t perform that action at this time.
0 commit comments