【工具】刷新资源路径工具不再自动重命名
parent
12ecb9f437
commit
30b1091289
|
@ -264,22 +264,22 @@ namespace GameEditor
|
|||
if (resPaths.ContainsKey (fileName)) {
|
||||
var info = resPaths[fileName];
|
||||
string oldPath = string.Format("{0}/{1}{2}", dirPaths[info.resPathIndex], info.resName, info.extension);
|
||||
Debug.LogErrorFormat("资源名重复:{0}=>{1}", path, oldPath);
|
||||
string exName = Path.GetExtension(path).Replace(".", "");
|
||||
if (!string.IsNullOrEmpty(exName)) //给资源文件加后缀名规避重复
|
||||
{
|
||||
if (exName != "prefab")//避免给prefab文件更名
|
||||
{
|
||||
string newPath = AssetDatabase.RenameAsset(path, Path.GetFileNameWithoutExtension(path) + "_" + exName);
|
||||
Debug.LogErrorFormat("资源名已修正:{0} 请再次刷新文件路径", path);
|
||||
}
|
||||
else
|
||||
{
|
||||
string newPath = AssetDatabase.RenameAsset(oldPath, Path.GetFileNameWithoutExtension(oldPath)
|
||||
+ "_" + Path.GetExtension(oldPath).Replace(".", ""));
|
||||
Debug.LogErrorFormat("资源名已修正:{0} 请再次刷新文件路径", oldPath);
|
||||
}
|
||||
}
|
||||
Debug.LogErrorFormat("资源名重复:{0}\n原有资源:{2}\n重复资源:{1}", info.resName, path, oldPath);
|
||||
//string exName = Path.GetExtension(path).Replace(".", "");
|
||||
//if (!string.IsNullOrEmpty(exName)) //给资源文件加后缀名规避重复
|
||||
//{
|
||||
// if (exName != "prefab")//避免给prefab文件更名
|
||||
// {
|
||||
// string newPath = AssetDatabase.RenameAsset(path, Path.GetFileNameWithoutExtension(path) + "_" + exName);
|
||||
// Debug.LogErrorFormat("资源名已修正:{0} 请再次刷新文件路径", path);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// string newPath = AssetDatabase.RenameAsset(oldPath, Path.GetFileNameWithoutExtension(oldPath)
|
||||
// + "_" + Path.GetExtension(oldPath).Replace(".", ""));
|
||||
// Debug.LogErrorFormat("资源名已修正:{0} 请再次刷新文件路径", oldPath);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue