Ver Fonte

Merge pull request #412 from Areloch/LinuxBugfixes

Fixes a few bugs/issues on Linux
Brian Roberts há 4 anos atrás
pai
commit
b2495fe957

+ 8 - 1
Engine/source/cinterface/c_controlInterface.cpp

@@ -35,6 +35,9 @@ extern void createFontInit(void);
 extern void createFontShutdown(void);
 extern void createFontShutdown(void);
 #endif
 #endif
 
 
+#if defined(TORQUE_SDL)
+#include "SDL.h"
+#endif
 
 
 #if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE )
 #if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE )
 extern S32 CreateMiniDump(LPEXCEPTION_POINTERS ExceptionInfo);
 extern S32 CreateMiniDump(LPEXCEPTION_POINTERS ExceptionInfo);
@@ -227,7 +230,11 @@ extern "C" {
 
 
    const char* torque_getexecutablepath()
    const char* torque_getexecutablepath()
    {
    {
+#if defined(TORQUE_SDL)
+      return gExecutablePath ? gExecutablePath : SDL_GetBasePath();
+#elif
       return gExecutablePath;
       return gExecutablePath;
+#endif
    }
    }
 
 
    void torque_setexecutablepath(const char* directory)
    void torque_setexecutablepath(const char* directory)
@@ -236,4 +243,4 @@ extern "C" {
       gExecutablePath = new char[pathLen];
       gExecutablePath = new char[pathLen];
       dStrcpy(gExecutablePath, directory, pathLen);
       dStrcpy(gExecutablePath, directory, pathLen);
    }
    }
-}
+}

+ 5 - 4
Engine/source/platformX86UNIX/x86UNIXFileio.cpp

@@ -332,7 +332,7 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite)
  }
  }
 
 
  //-----------------------------------------------------------------------------
  //-----------------------------------------------------------------------------
- static bool RecurseDumpPath(const char *path, const char* relativePath, const char *pattern, Vector<Platform::FileInfo> &fileVector)
+ static bool RecurseDumpPath(const char *path, const char* relativePath, const char *pattern, Vector<Platform::FileInfo> &fileVector, S32 currentDepth = 0, S32 recurseDepth = -1)
  {
  {
     char search[1024];
     char search[1024];
 
 
@@ -382,7 +382,8 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite)
                 relativePath, fEntry->d_name);
                 relativePath, fEntry->d_name);
              childRelative = childRelativeBuf;
              childRelative = childRelativeBuf;
           }
           }
-          RecurseDumpPath(child, childRelative, pattern, fileVector);
+          if (currentDepth < recurseDepth || recurseDepth == -1 )
+            RecurseDumpPath(child, childRelative, pattern, fileVector, currentDepth+1, recurseDepth);
        }
        }
        else
        else
        {
        {
@@ -908,7 +909,7 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite)
     {
     {
        char prefPathName[MaxPath];
        char prefPathName[MaxPath];
        MungePath(prefPathName, MaxPath, path, GetPrefDir());
        MungePath(prefPathName, MaxPath, path, GetPrefDir());
-       RecurseDumpPath(prefPathName, path, pattern, fileVector);
+       RecurseDumpPath(prefPathName, path, pattern, fileVector, 0, depth);
     }
     }
 
 
     // munge the requested path and dump it
     // munge the requested path and dump it
@@ -916,7 +917,7 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite)
     char cwd[MaxPath];
     char cwd[MaxPath];
     getcwd(cwd, MaxPath);
     getcwd(cwd, MaxPath);
     MungePath(mungedPath, MaxPath, path, cwd);
     MungePath(mungedPath, MaxPath, path, cwd);
-    return RecurseDumpPath(mungedPath, path, pattern, fileVector);
+    return RecurseDumpPath(mungedPath, path, pattern, fileVector, 0, depth);
  }
  }
 
 
  //-----------------------------------------------------------------------------
  //-----------------------------------------------------------------------------