Skip to content

Commit 942b319

Browse files
path validation when creating new volume profile (#36)
1 parent 65d0145 commit 942b319

File tree

2 files changed

+403
-337
lines changed

2 files changed

+403
-337
lines changed

com.unity.render-pipelines.core/Editor/Volume/VolumeProfileFactory.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,22 @@ public static VolumeProfile CreateVolumeProfile(Scene scene, string targetName)
5656
{
5757
var scenePath = Path.GetDirectoryName(scene.path);
5858
var extPath = scene.name;
59-
var profilePath = scenePath + "/" + extPath;
59+
var profilePath = scenePath + Path.DirectorySeparatorChar + extPath;
6060

6161
if (!AssetDatabase.IsValidFolder(profilePath))
62-
AssetDatabase.CreateFolder(scenePath, extPath);
62+
{
63+
var directories = profilePath.Split(Path.DirectorySeparatorChar);
64+
string rootPath = "";
65+
foreach (var directory in directories)
66+
{
67+
var newPath = rootPath + directory;
68+
if (!AssetDatabase.IsValidFolder(newPath))
69+
AssetDatabase.CreateFolder(rootPath.TrimEnd(Path.DirectorySeparatorChar), directory);
70+
rootPath = newPath + Path.DirectorySeparatorChar;
71+
}
72+
}
6373

64-
path = profilePath + "/";
74+
path = profilePath + Path.DirectorySeparatorChar;
6575
}
6676

6777
path += targetName + " Profile.asset";

0 commit comments

Comments
 (0)