Bug fixes for alternative zip layout and define to toggle it on

This commit is contained in:
Tim Newell 2012-12-15 15:30:10 -05:00 committed by DavidWyand-GG
parent 3df2aa64f4
commit 31036c4031
9 changed files with 46 additions and 5 deletions

View file

@ -29,6 +29,7 @@
#include "app/mainLoop.h" #include "app/mainLoop.h"
#include "platform/input/event.h" #include "platform/input/event.h"
#include "platform/typetraits.h" #include "platform/typetraits.h"
#include "core/volume.h"
const F32 TypeTraits< F32 >::MIN = - F32_MAX; const F32 TypeTraits< F32 >::MIN = - F32_MAX;
@ -132,8 +133,10 @@ const bool Platform::KeyboardInputExclusion::checkAgainstInput( const InputEvent
S32 Platform::compareModifiedTimes( const char *firstPath, const char *secondPath ) S32 Platform::compareModifiedTimes( const char *firstPath, const char *secondPath )
{ {
FileTime firstModTime; FileTime firstModTime;
if ( !getFileTimes( firstPath, NULL, &firstModTime ) ) if ( !getFileTimes( firstPath, NULL, &firstModTime ) ) {
return -1; //The reason we failed to get file times could be cause it is in a zip. Lets check.
return Torque::FS::CompareModifiedTimes(firstPath, secondPath);
}
FileTime secondModTime; FileTime secondModTime;
if ( !getFileTimes( secondPath, NULL, &secondModTime ) ) if ( !getFileTimes( secondPath, NULL, &secondModTime ) )

View file

@ -70,7 +70,11 @@ bool MountZips(const String &root)
for(S32 i = 0;i < outList.size();++i) for(S32 i = 0;i < outList.size();++i)
{ {
String &zipfile = outList[i]; String &zipfile = outList[i];
#ifdef TORQUE_ZIP_DISK_LAYOUT
mounted += (S32)Mount(root, new ZipFileSystem(zipfile, false));
#else
mounted += (S32)Mount(root, new ZipFileSystem(zipfile, true)); mounted += (S32)Mount(root, new ZipFileSystem(zipfile, true));
#endif
} }
return mounted == outList.size(); return mounted == outList.size();

View file

@ -49,6 +49,8 @@
#include "platform/profiler.h" #include "platform/profiler.h"
#include "cinterface/cinterface.h"; #include "cinterface/cinterface.h";
#include "core/volume.h"
//TODO: file io still needs some work... //TODO: file io still needs some work...
#define MAX_MAC_PATH_LONG 2048 #define MAX_MAC_PATH_LONG 2048
@ -634,7 +636,10 @@ bool Platform::isFile(const char *path)
// make sure we can stat the file // make sure we can stat the file
struct stat statData; struct stat statData;
if( stat(path, &statData) < 0 ) if( stat(path, &statData) < 0 )
return false; {
// Since file does not exist on disk see if it exists in a zip file loaded
return Torque::FS::IsFile(path);
}
// now see if it's a regular file // now see if it's a regular file
if( (statData.st_mode & S_IFMT) == S_IFREG) if( (statData.st_mode & S_IFMT) == S_IFREG)

View file

@ -29,6 +29,7 @@
#include "core/strings/unicode.h" #include "core/strings/unicode.h"
#include "util/tempAlloc.h" #include "util/tempAlloc.h"
#include "core/util/safeDelete.h" #include "core/util/safeDelete.h"
#include "core/volume.h"
// Microsoft VC++ has this POSIX header in the wrong directory // Microsoft VC++ has this POSIX header in the wrong directory
#if defined(TORQUE_COMPILER_VISUALC) #if defined(TORQUE_COMPILER_VISUALC)
@ -946,7 +947,11 @@ bool Platform::isFile(const char *pFilePath)
FindClose(handle); FindClose(handle);
if(handle == INVALID_HANDLE_VALUE) if(handle == INVALID_HANDLE_VALUE)
return false; {
// Since file does not exist on disk see if it exists in a zip file loaded
return Torque::FS::IsFile(pFilePath);
}
// if the file is a Directory, Offline, System or Temporary then FALSE // if the file is a Directory, Offline, System or Temporary then FALSE
if (findData.dwFileAttributes & if (findData.dwFileAttributes &

View file

@ -56,6 +56,7 @@
#include "core/strings/stringFunctions.h" #include "core/strings/stringFunctions.h"
#include "util/tempAlloc.h" #include "util/tempAlloc.h"
#include "cinterface/cinterface.h" #include "cinterface/cinterface.h"
#include "core/volume.h"
#if defined(__FreeBSD__) #if defined(__FreeBSD__)
#include <sys/types.h> #include <sys/types.h>
@ -980,7 +981,10 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite)
// Get file info // Get file info
struct stat fStat; struct stat fStat;
if (stat(pFilePath, &fStat) < 0) if (stat(pFilePath, &fStat) < 0)
return false; {
// Since file does not exist on disk see if it exists in a zip file loaded
return Torque::FS::IsFile(pFilePath);
}
// if the file is a "regular file" then true // if the file is a "regular file" then true
if ( (fStat.st_mode & S_IFMT) == S_IFREG) if ( (fStat.st_mode & S_IFMT) == S_IFREG)

View file

@ -73,6 +73,11 @@
/// the root of the path. Requires the virtual mount system to be active. /// the root of the path. Requires the virtual mount system to be active.
//#define TORQUE_DISABLE_FIND_ROOT_WITHIN_ZIP //#define TORQUE_DISABLE_FIND_ROOT_WITHIN_ZIP
//Uncomment this define if you want to use the alternative zip support where you can
//define your directories and files inside the zip just like you would on disk
//instead of the default zip support that treats the zip as an extra directory.
//#define TORQUE_ZIP_DISK_LAYOUT
/// Define me if you don't want Torque to compile dso's /// Define me if you don't want Torque to compile dso's
#define TORQUE_NO_DSO_GENERATION #define TORQUE_NO_DSO_GENERATION

View file

@ -73,6 +73,11 @@
/// the root of the path. Requires the virtual mount system to be active. /// the root of the path. Requires the virtual mount system to be active.
//#define TORQUE_DISABLE_FIND_ROOT_WITHIN_ZIP //#define TORQUE_DISABLE_FIND_ROOT_WITHIN_ZIP
//Uncomment this define if you want to use the alternative zip support where you can
//define your directories and files inside the zip just like you would on disk
//instead of the default zip support that treats the zip as an extra directory.
//#define TORQUE_ZIP_DISK_LAYOUT
/// Define me if you don't want Torque to compile dso's /// Define me if you don't want Torque to compile dso's
#define TORQUE_NO_DSO_GENERATION #define TORQUE_NO_DSO_GENERATION

View file

@ -73,6 +73,11 @@
/// the root of the path. Requires the virtual mount system to be active. /// the root of the path. Requires the virtual mount system to be active.
//#define TORQUE_DISABLE_FIND_ROOT_WITHIN_ZIP //#define TORQUE_DISABLE_FIND_ROOT_WITHIN_ZIP
//Uncomment this define if you want to use the alternative zip support where you can
//define your directories and files inside the zip just like you would on disk
//instead of the default zip support that treats the zip as an extra directory.
//#define TORQUE_ZIP_DISK_LAYOUT
/// Define me if you don't want Torque to compile dso's /// Define me if you don't want Torque to compile dso's
#define TORQUE_NO_DSO_GENERATION #define TORQUE_NO_DSO_GENERATION

View file

@ -73,6 +73,11 @@
/// the root of the path. Requires the virtual mount system to be active. /// the root of the path. Requires the virtual mount system to be active.
//#define TORQUE_DISABLE_FIND_ROOT_WITHIN_ZIP //#define TORQUE_DISABLE_FIND_ROOT_WITHIN_ZIP
//Uncomment this define if you want to use the alternative zip support where you can
//define your directories and files inside the zip just like you would on disk
//instead of the default zip support that treats the zip as an extra directory.
//#define TORQUE_ZIP_DISK_LAYOUT
/// Define me if you don't want Torque to compile dso's /// Define me if you don't want Torque to compile dso's
#define TORQUE_NO_DSO_GENERATION #define TORQUE_NO_DSO_GENERATION