Trim and remove (Instance) from file names:

* Related: #857
This commit is contained in:
Jeremy Pritts 2023-06-15 12:18:42 -04:00
parent ad5606971b
commit c04c9241b7
2 changed files with 8 additions and 1 deletions

View File

@ -74,7 +74,9 @@ namespace AssetRipper.Export.UnityProjects.Project.Collections
_ => asset.GetBestName(),
};
fileName = FileUtils.RemoveCloneSuffixes(fileName);
if (string.IsNullOrWhiteSpace(fileName))
fileName = FileUtils.RemoveInstanceSuffixes(fileName);
fileName = fileName.Trim();
if (string.IsNullOrEmpty(fileName))
{
fileName = asset.ClassName;
}

View File

@ -28,6 +28,11 @@ namespace AssetRipper.IO.Files.Utils
return path.Replace("(Clone)", string.Empty);
}
public static string RemoveInstanceSuffixes(string path)
{
return path.Replace("(Instance)", string.Empty);
}
public static string GetUniqueName(string dirPath, string fileName, int maxNameLength)
{
string? ext = null;