Update EditorTools.cs

pull/332/head
hevinci 2024-07-31 12:01:29 +08:00
parent 6680a6450b
commit 51f2709956
1 changed files with 15 additions and 0 deletions

View File

@ -559,6 +559,21 @@ namespace YooAsset.Editor
{ {
return path.Replace('\\', '/').Replace("\\", "/"); //替换为Linux路径格式 return path.Replace('\\', '/').Replace("\\", "/"); //替换为Linux路径格式
} }
/// <summary>
/// 移除路径里的后缀名
/// </summary>
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"
}
/// <summary> /// <summary>
/// 获取项目工程路径 /// 获取项目工程路径