Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Commit

Permalink
Changes path to be relative to the project if a full path is provided (
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenHodgson authored Apr 12, 2020
1 parent c7bbe1a commit fedff63
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public static ScriptableObject CreateAsset(this ScriptableObject scriptableObjec
path = MixedRealityPreferences.ProfileGenerationPath;
}

path = path.Replace(".asset", string.Empty);

if (!string.IsNullOrWhiteSpace(Path.GetExtension(path)))
{
var subtractedPath = path.Substring(path.LastIndexOf("/", StringComparison.Ordinal));
Expand All @@ -63,7 +65,7 @@ public static ScriptableObject CreateAsset(this ScriptableObject scriptableObjec
Directory.CreateDirectory(Path.GetFullPath(path));
}

path = path.Replace(".asset", string.Empty);
path = path.Replace($"{Directory.GetParent(Application.dataPath).FullName}\\", string.Empty);

string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath($"{path}/{name}.asset");

Expand Down

0 comments on commit fedff63

Please sign in to comment.