This commit is contained in:
sorgelig
2020-01-20 14:04:36 +08:00
parent 8f4828c1cc
commit 35f81c3826
6 changed files with 20 additions and 19 deletions

View File

@@ -82,10 +82,10 @@ static int FileIsZipped(char* path, char** zip_path, char** file_path)
return 0;
}
static char* make_fullpath(const char *path, int mode = 0, bool absolutePath = false)
static char* make_fullpath(const char *path, int mode = 0)
{
const char *root = getRootDir();
if (!absolutePath && strncasecmp(getRootDir(), path, strlen(root)))
if (path[0] != '/')
{
sprintf(full_path, "%s/%s", (mode == -1) ? "" : root, path);
}
@@ -253,9 +253,9 @@ static int zip_search_by_crc(mz_zip_archive *zipArchive, uint32_t crc32)
return -1;
}
int FileOpenZip(fileTYPE *file, const char *name, uint32_t crc32, bool absolutePath)
int FileOpenZip(fileTYPE *file, const char *name, uint32_t crc32)
{
make_fullpath(name, 0, absolutePath);
make_fullpath(name);
FileClose(file);
file->mode = 0;
file->type = 0;
@@ -317,9 +317,9 @@ int FileOpenZip(fileTYPE *file, const char *name, uint32_t crc32, bool absoluteP
return 1;
}
int FileOpenEx(fileTYPE *file, const char *name, int mode, char mute, bool absolutePath)
int FileOpenEx(fileTYPE *file, const char *name, int mode, char mute)
{
make_fullpath((char*)name, mode, absolutePath);
make_fullpath((char*)name, mode);
FileClose(file);
file->mode = 0;
file->type = 0;
@@ -461,9 +461,9 @@ __off64_t FileGetSize(fileTYPE *file)
return 0;
}
int FileOpen(fileTYPE *file, const char *name, char mute, bool absolutePath)
int FileOpen(fileTYPE *file, const char *name, char mute)
{
return FileOpenEx(file, name, O_RDONLY, mute, absolutePath);
return FileOpenEx(file, name, O_RDONLY, mute);
}
int FileSeek(fileTYPE *file, __off64_t offset, int origin)