From 51f27099561543c431727bcdbde57ed41a93d897 Mon Sep 17 00:00:00 2001 From: hevinci Date: Wed, 31 Jul 2024 12:01:29 +0800 Subject: [PATCH] Update EditorTools.cs --- Assets/YooAsset/Editor/EditorTools.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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" + } /// /// 获取项目工程路径