[unity] Better GetPathSafeName

This commit is contained in:
pharan 2018-04-25 09:53:49 +08:00
parent 7e910cb8f7
commit aea15e63d8

View File

@ -1554,12 +1554,11 @@ namespace Spine.Unity.Editor {
}
#endregion
//public static string GetPathSafeRegionName (AtlasRegion region) {
// return region.name.Replace("/", "_");
//}
public static string GetPathSafeName (string name) {
return name.Replace("/", "_");
foreach (char c in System.IO.Path.GetInvalidFileNameChars()) { // Doesn't handle more obscure file name limitations.
name = name.Replace(c, '_');
}
return name;
}
}