Merge branch 'dev'

This commit is contained in:
Jonas Kulla 2014-01-15 01:56:58 +01:00
commit 81ec731e5a
2 changed files with 17 additions and 12 deletions

View File

@ -47,7 +47,6 @@ struct Exception
Type type; Type type;
std::string msg; std::string msg;
Exception(Type type, const char *format, ...) Exception(Type type, const char *format, ...)
: type(type) : type(type)
{ {

View File

@ -309,7 +309,7 @@ RGSS_openArchive(PHYSFS_Io *io, const char *, int forWrite)
uint32_t magic = RGSS_MAGIC; uint32_t magic = RGSS_MAGIC;
/* Top level entry list */ /* Top level entry list */
BoostSet<std::string> &topLevel = data->dirHash["."]; BoostSet<std::string> &topLevel = data->dirHash[""];
while (true) while (true)
{ {
@ -620,8 +620,7 @@ struct FileSystemPrivate
const char *foundName = completeFileName(filename, type, foundExt); const char *foundName = completeFileName(filename, type, foundExt);
if (!foundName) if (!foundName)
throw Exception(Exception::NoFileError, throw Exception(Exception::NoFileError, "%s", filename);
"No such file or directory - %s", filename);
PHYSFS_File *handle = PHYSFS_openRead(foundName); PHYSFS_File *handle = PHYSFS_openRead(foundName);
if (!handle) if (!handle)
@ -695,17 +694,23 @@ static void cacheEnumCB(void *d, const char *origdir,
char buf[512]; char buf[512];
if (*origdir != '.') if (*origdir == '\0')
snprintf(buf, sizeof(buf), "%s/%s", origdir, fname);
else
strncpy(buf, fname, sizeof(buf)); strncpy(buf, fname, sizeof(buf));
else
snprintf(buf, sizeof(buf), "%s/%s", origdir, fname);
std::string mixedCase(buf); char *ptr = buf;
/* Trim leading slash */
if (*ptr == '/')
++ptr;
std::string mixedCase(ptr);
for (char *p = buf; *p; ++p) for (char *p = buf; *p; ++p)
*p = tolower(*p); *p = tolower(*p);
std::string lowerCase(buf); std::string lowerCase(ptr);
p->pathCache.insert(lowerCase, mixedCase); p->pathCache.insert(lowerCase, mixedCase);
@ -714,7 +719,7 @@ static void cacheEnumCB(void *d, const char *origdir,
void FileSystem::createPathCache() void FileSystem::createPathCache()
{ {
PHYSFS_enumerateFilesCallback(".", cacheEnumCB, p); PHYSFS_enumerateFilesCallback("", cacheEnumCB, p);
p->havePathCache = true; p->havePathCache = true;
} }
@ -734,14 +739,15 @@ static Sint64 SDL_RWopsSize(SDL_RWops *ops)
return PHYSFS_fileLength(f); return PHYSFS_fileLength(f);
} }
static Sint64 SDL_RWopsSeek(SDL_RWops *ops, Sint64 offset, int whence) static Sint64 SDL_RWopsSeek(SDL_RWops *ops, int64_t offset, int whence)
{ {
PHYSFS_File *f = sdlPHYS(ops); PHYSFS_File *f = sdlPHYS(ops);
if (!f) if (!f)
return -1; return -1;
Sint64 base; int64_t base;
switch (whence) switch (whence)
{ {
default: default: