浏览代码

Fixed bug in FileSystem for windows where gameplay-tests couldn't find the shader files.

Darryl Gough 13 年之前
父节点
当前提交
19dc9e579f
共有 1 个文件被更改,包括 15 次插入1 次删除
  1. 15 1
      gameplay/src/FileSystem.cpp

+ 15 - 1
gameplay/src/FileSystem.cpp

@@ -219,7 +219,14 @@ bool FileSystem::fileExists(const char* filePath)
         fullPath += "../../gameplay/";
         fullPath += filePath;
         
-        return stat(fullPath.c_str(), &s) == 0;
+        int result = stat(fullPath.c_str(), &s);
+        if (result != 0)
+        {
+            fullPath = __resourcePath;
+            fullPath += "../gameplay/";
+            fullPath += filePath;
+            return stat(fullPath.c_str(), &s) == 0;
+        }
     }
     return true;
 #else
@@ -248,6 +255,13 @@ FILE* FileSystem::openFile(const char* path, const char* mode)
         fullPath += path;
         
         fp = fopen(fullPath.c_str(), mode);
+        if (!fp)
+        {
+            fullPath = __resourcePath;
+            fullPath += "../gameplay/";
+            fullPath += path;
+            fp = fopen(fullPath.c_str(), mode);
+        }
     }
 #endif