Просмотр исходного кода

Updated resource manifest so it stores and compares standardized paths

Marko Pintera 12 лет назад
Родитель
Сommit
0a1c509871
2 измененных файлов с 17 добавлено и 15 удалено
  1. 17 7
      CamelotCore/Source/CmResourceManifest.cpp
  2. 0 8
      ProjectLibrary.txt

+ 17 - 7
CamelotCore/Source/CmResourceManifest.cpp

@@ -1,5 +1,6 @@
 #include "CmResourceManifest.h"
 #include "CmResourceManifestRTTI.h"
+#include "CmPath.h"
 
 namespace CamelotFramework
 {
@@ -7,20 +8,23 @@ namespace CamelotFramework
 	{
 		auto iterFind = mUUIDToFilePath.find(uuid);
 
+		WString standardizedFilePath = Path::standardizePath(filePath);
+		StringUtil::toLowerCase(standardizedFilePath);
+
 		if(iterFind != mUUIDToFilePath.end())
 		{
-			if(iterFind->second != filePath)
+			if(iterFind->second != standardizedFilePath)
 			{
 				mFilePathToUUID.erase(iterFind->second);
 
-				mUUIDToFilePath[uuid] = filePath;
-				mFilePathToUUID[filePath] = uuid;
+				mUUIDToFilePath[uuid] = standardizedFilePath;
+				mFilePathToUUID[standardizedFilePath] = uuid;
 			}
 		}
 		else
 		{
-			mUUIDToFilePath[uuid] = filePath;
-			mFilePathToUUID[filePath] = uuid;
+			mUUIDToFilePath[uuid] = standardizedFilePath;
+			mFilePathToUUID[standardizedFilePath] = uuid;
 		}
 	}
 
@@ -47,7 +51,10 @@ namespace CamelotFramework
 
 	const String& ResourceManifest::filePathToUUID(const WString& filePath) const
 	{
-		auto iterFind = mFilePathToUUID.find(filePath);
+		WString standardizedFilePath = Path::standardizePath(filePath);
+		StringUtil::toLowerCase(standardizedFilePath);
+
+		auto iterFind = mFilePathToUUID.find(standardizedFilePath);
 
 		if(iterFind != mFilePathToUUID.end())
 			return iterFind->second;
@@ -64,7 +71,10 @@ namespace CamelotFramework
 
 	bool ResourceManifest::filePathExists(const WString& filePath) const
 	{
-		auto iterFind = mFilePathToUUID.find(filePath);
+		WString standardizedFilePath = Path::standardizePath(filePath);
+		StringUtil::toLowerCase(standardizedFilePath);
+
+		auto iterFind = mFilePathToUUID.find(standardizedFilePath);
 
 		return iterFind != mFilePathToUUID.end();
 	}

+ 0 - 8
ProjectLibrary.txt

@@ -1,9 +1,5 @@
 
 TODO
- - Moving files within the TreeView will still cause them to be reimported
-  - UUIDs in meta files dont seem to match.
-  - I need a way to import a resource while keeping the existing UUID (maybe reimport() method?)
- - ResourceManifest filePathToUUID wont work as intended as file-path comparison is case sensitive plus it wont deal with slashes properly
  - ProjectLibrary Save/Load - saves/loads the hierarchy of ResourceEntries
     - ResourceManifest needs to store relative locations when I save it, so that user can move Project folder safely
  - Resource import queue (ability to display progress bar for resources that are importing)
@@ -12,10 +8,6 @@ TODO
 --------------------
 
 Test:
- - File monitoring
-    - Delete a file and ensure it has been cleaned up
-    - Delete a folder hierarcha and ensure it has been cleaned up
-
  - Save/Load (After it is implemented)
      - Ensure that leaving application and then reloading will still recognize previously saved assets and will not reimport them
        - Also ensure that UUIDs will be properly read from .meta files