소스 검색

[unity] Better GetPathSafeName

pharan 7 년 전
부모
커밋
aea15e63d8
1개의 변경된 파일4개의 추가작업 그리고 5개의 파일을 삭제
  1. 4 5
      spine-unity/Assets/spine-unity/Editor/SpineEditorUtilities.cs

+ 4 - 5
spine-unity/Assets/spine-unity/Editor/SpineEditorUtilities.cs

@@ -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;
 		}
 	}