Skip to content

Commit a7de072

Browse files
author
Brian MacIntosh
committed
some folder metas may be missing isFolderAsset - add a fallback for those
1 parent a1820af commit a7de072

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

UnityProjectBrowser/Parsers/UnityMetaParser.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ public override void ParseFile(string absolutePath)
5555
YamlScalarNode folderAssetScalarNode = (YamlScalarNode)folderAssetNode;
5656
isFolderAsset = folderAssetScalarNode.Value == "yes";
5757
}
58+
else
59+
{
60+
// seems folder assets may randomly not have a folderAsset value
61+
// try to identify them by the absence of other data
62+
if (rootNode.Children.Count == 2 && Directory.Exists(UnityFolder.GetFolderPathForMeta(absolutePath)))
63+
{
64+
isFolderAsset = true;
65+
}
66+
}
5867

5968
if (isFolderAsset)
6069
{

UnityProjectBrowser/Structure/Unity/UnityFolder.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,18 @@ public string FolderPath
1616
get
1717
{
1818
string filePath = GetFilePath();
19-
return Path.Combine(Path.GetDirectoryName(filePath), Path.GetFileNameWithoutExtension(filePath));
19+
return GetFolderPathForMeta(filePath);
2020
}
2121
}
2222

23+
/// <summary>
24+
/// Returns the directory path for the specified folder meta.
25+
/// </summary>
26+
public static string GetFolderPathForMeta(string folderMeta)
27+
{
28+
return Path.Combine(Path.GetDirectoryName(folderMeta), Path.GetFileNameWithoutExtension(folderMeta));
29+
}
30+
2331
/// <summary>
2432
///
2533
/// </summary>

0 commit comments

Comments
 (0)