Переглянути джерело

Project library cut/copy/paste no longer triggers an unnecessary reimport, and the resources don't lose their meta-data after the operation

BearishSun 9 роки тому
батько
коміт
326d9c669c
1 змінених файлів з 4 додано та 28 видалено
  1. 4 28
      Source/MBansheeEditor/Windows/Library/LibraryWindow.cs

+ 4 - 28
Source/MBansheeEditor/Windows/Library/LibraryWindow.cs

@@ -710,15 +710,7 @@ namespace BansheeEditor
 
 
             foreach (var source in filePaths)
             foreach (var source in filePaths)
             {
             {
-                string path = source;
-                if (!Path.IsPathRooted(path))
-                    path = Path.Combine(ProjectLibrary.ResourceFolder, path);
-
-                if (Directory.Exists(path))
-                    DirectoryEx.Copy(path, LibraryUtility.GetUniquePath(path));
-                else if (File.Exists(path))
-                    FileEx.Copy(path, LibraryUtility.GetUniquePath(path));
-
+                ProjectLibrary.Copy(source, LibraryUtility.GetUniquePath(source));
                 ProjectLibrary.Refresh();
                 ProjectLibrary.Refresh();
             }
             }
         }
         }
@@ -738,16 +730,8 @@ namespace BansheeEditor
             {
             {
                 for (int i = 0; i < copyPaths.Count; i++)
                 for (int i = 0; i < copyPaths.Count; i++)
                 {
                 {
-                    string path = copyPaths[i];
-                    if (!Path.IsPathRooted(path))
-                        path = Path.Combine(ProjectLibrary.ResourceFolder, path);
-
                     string destination = Path.Combine(rootedDestinationFolder, PathEx.GetTail(copyPaths[i]));
                     string destination = Path.Combine(rootedDestinationFolder, PathEx.GetTail(copyPaths[i]));
-
-                    if (Directory.Exists(path))
-                        DirectoryEx.Copy(path, LibraryUtility.GetUniquePath(destination));
-                    else if (File.Exists(path))
-                        FileEx.Copy(path, LibraryUtility.GetUniquePath(destination));
+                    ProjectLibrary.Copy(copyPaths[i], LibraryUtility.GetUniquePath(destination));
                 }
                 }
 
 
                 ProjectLibrary.Refresh();
                 ProjectLibrary.Refresh();
@@ -756,16 +740,8 @@ namespace BansheeEditor
             {
             {
                 for (int i = 0; i < cutPaths.Count; i++)
                 for (int i = 0; i < cutPaths.Count; i++)
                 {
                 {
-                    string path = cutPaths[i];
-                    if (!Path.IsPathRooted(path))
-                        path = Path.Combine(ProjectLibrary.ResourceFolder, path);
-
                     string destination = Path.Combine(rootedDestinationFolder, PathEx.GetTail(cutPaths[i]));
                     string destination = Path.Combine(rootedDestinationFolder, PathEx.GetTail(cutPaths[i]));
-
-                    if (Directory.Exists(path))
-                        DirectoryEx.Move(path, LibraryUtility.GetUniquePath(destination));
-                    else if (File.Exists(path))
-                        FileEx.Move(path, LibraryUtility.GetUniquePath(destination));
+                    ProjectLibrary.Move(cutPaths[i], LibraryUtility.GetUniquePath(destination));
                 }
                 }
 
 
                 cutPaths.Clear();
                 cutPaths.Clear();
@@ -1426,7 +1402,7 @@ namespace BansheeEditor
                         if (newFile)
                         if (newFile)
                             DirectoryEx.Copy(absolutePath, uniqueDestination);
                             DirectoryEx.Copy(absolutePath, uniqueDestination);
                         else
                         else
-                            DirectoryEx.Move(absolutePath, uniqueDestination);
+                            ProjectLibrary.Move(absolutePath, uniqueDestination);
                     }
                     }
                     else if (File.Exists(path))
                     else if (File.Exists(path))
                     {
                     {