Skip to content

Commit

Permalink
Check for invalid paths in build reports
Browse files Browse the repository at this point in the history
  • Loading branch information
oneVR committed Apr 30, 2024
1 parent dfc5e3b commit 9982f51
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions Editor/BuildReportTreeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,40 @@ protected override TreeViewItem BuildRoot()
0,
AssetDatabase.GetCachedIcon(asset.FullPath),
asset.AssetType,
asset.FullPath == "" ? "Unknown" : Path.GetFileName(asset.FullPath),
GetFileName(asset.FullPath),
asset.FullPath,
Path.GetExtension(asset.FullPath),
GetFileExtension(asset.FullPath),
asset.Size,
asset.Percentage)
);
}

return root;

static string GetFileName(string path)
{
if (string.IsNullOrEmpty(path))
{
return "Unknown";
}

if (path.IndexOfAny(Path.GetInvalidPathChars()) >= 0)
{
return path;
}

return Path.GetFileName(path);
}

static string GetFileExtension(string path)
{
if (string.IsNullOrEmpty(path) || path.IndexOfAny(Path.GetInvalidPathChars()) >= 0)
{
return "Unknown";
}

return Path.GetExtension(path);
}
}

public void SetReport(BuildReport newReport)
Expand Down

0 comments on commit 9982f51

Please sign in to comment.