AssetFolder OpenFolderForResource(string relativePath) { var pathItems = PBX.Utils.SplitPath(relativePath).ToList(); // remove path filename pathItems.RemoveAt(pathItems.Count - 1); AssetFolder folder = root; foreach (var pathItem in pathItems) { folder = folder.OpenFolder(pathItem); } return(folder); }
// Checks if a folder with given path exists and returns it if it does. // Otherwise, creates a new folder. Parent folders are created if needed. public AssetFolder OpenFolder(string relativePath) { if (relativePath == null) { return(root); } var pathItems = PBX.Utils.SplitPath(relativePath); if (pathItems.Length == 0) { return(root); } AssetFolder folder = root; foreach (var pathItem in pathItems) { folder = folder.OpenFolder(pathItem); } return(folder); }