浏览代码

Fixed an issue where urls were sometimes incorrectly parsed in .scene files.

sgrenier 11 年之前
父节点
当前提交
606f35a258
共有 1 个文件被更改,包括 16 次插入12 次删除
  1. 16 12
      gameplay/src/SceneLoader.cpp

+ 16 - 12
gameplay/src/SceneLoader.cpp

@@ -1203,29 +1203,33 @@ void splitURL(const std::string& url, std::string* file, std::string* id)
         return;
     }
 
-    // Check if the url references a file (otherwise, it only references a node within the main GPB).
-    size_t loc = url.rfind(".");
+    // Check if the url references a file (otherwise, it only references some sort of ID)
+    size_t loc = url.rfind("#"); 
     if (loc != std::string::npos)
     {
-        // If the url references a specific namespace within the file,
-        // set the id out parameter appropriately. Otherwise, set the id out
-        // parameter to the empty string so we know to load the first namespace.
-        loc = url.rfind("#");
-        if (loc != std::string::npos)
+        *file = url.substr(0, loc);
+        if (FileSystem::fileExists(file->c_str()))
         {
-            *file = url.substr(0, loc);
             *id = url.substr(loc + 1);
         }
         else
         {
-            *file = url;
-            *id = std::string();
+            *file = std::string();
+            *id = url;
         }
     }
     else
     {
-        *file = std::string();
-        *id = url;
+        if (FileSystem::fileExists(url.c_str()))
+        {
+            *file = url;
+            *id = std::string();
+        }
+        else
+        {
+            *file = std::string();
+            *id = url;
+        }
     }
 }