diff --git a/Assets/YooAsset/Editor/EditorTools.cs b/Assets/YooAsset/Editor/EditorTools.cs index 03fbc34..9f06072 100644 --- a/Assets/YooAsset/Editor/EditorTools.cs +++ b/Assets/YooAsset/Editor/EditorTools.cs @@ -559,6 +559,21 @@ namespace YooAsset.Editor { return path.Replace('\\', '/').Replace("\\", "/"); //替换为Linux路径格式 } + + /// + /// 移除路径里的后缀名 + /// + public static string RemoveExtension(string str) + { + if (string.IsNullOrEmpty(str)) + return str; + + int index = str.LastIndexOf('.'); + if (index == -1) + return str; + else + return str.Remove(index); //"assets/config/test.unity3d" --> "assets/config/test" + } /// /// 获取项目工程路径