Creates any missing folders in the path.
Unlike AssetDatabase.CreateFolder this creates the entire path in one go rather than each folder one by one.
Path may point to either a file or folder. If the last path element has an extension it is considered a file.
255 {
256 ThrowIf.ArgumentIsNull(path, nameof(path));
257 ThrowIf.PathIsNotValid(path);
258
260 return path.FolderPath.Guid;
261
262
263 var isPresumablyFilePath = String.IsNullOrEmpty(path.Extension) == false;
264 var folderPath = isPresumablyFilePath ? path.FolderPath : path;
266 return folderPath.Guid;
267
268 var folderNames = ((String)folderPath).Split(new[] { '/' });
269 var folderGuid = GuidForExistingPath(folderNames[0]);
270 var partialPath = folderNames[0];
271 for (var i = 1; i < folderNames.Length; i++)
272 {
273 partialPath += $"/{folderNames[i]}";
275 {
276 folderGuid = GuidForExistingPath(partialPath);
277 continue;
278 }
279
280 folderGuid = CreateSubFolder(
Get(folderGuid), folderNames[i]);
281 }
282
283 return folderGuid;
284 }
static Boolean FolderExists([NotNull] Path path)
Tests if the given folder exists in the file system.
static Path Get([NotNull] Object asset)
Gets the relative path of an asset.
static Boolean FileExists([NotNull] Path path)
Tests if the given file exists in the file system.