fixed various file operations using Path_SM instead of Path_Game
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40642
This commit is contained in:
parent
c02dbabe30
commit
62bd9ee7f8
@ -143,7 +143,7 @@ static cell_t sm_OpenFile(IPluginContext *pContext, const cell_t *params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char realpath[PLATFORM_MAX_PATH+1];
|
char realpath[PLATFORM_MAX_PATH+1];
|
||||||
g_SourceMod.BuildPath(Path_SM, realpath, sizeof(realpath), "%s", name);
|
g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
|
||||||
|
|
||||||
FILE *pFile = fopen(realpath, mode);
|
FILE *pFile = fopen(realpath, mode);
|
||||||
if (!pFile)
|
if (!pFile)
|
||||||
@ -165,7 +165,7 @@ static cell_t sm_DeleteFile(IPluginContext *pContext, const cell_t *params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char realpath[PLATFORM_MAX_PATH+1];
|
char realpath[PLATFORM_MAX_PATH+1];
|
||||||
g_SourceMod.BuildPath(Path_SM, realpath, sizeof(realpath), "%s", name);
|
g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
|
||||||
|
|
||||||
return (unlink(realpath)) ? 0 : 1;
|
return (unlink(realpath)) ? 0 : 1;
|
||||||
}
|
}
|
||||||
@ -269,7 +269,7 @@ static cell_t sm_FileExists(IPluginContext *pContext, const cell_t *params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char realpath[PLATFORM_MAX_PATH+1];
|
char realpath[PLATFORM_MAX_PATH+1];
|
||||||
g_SourceMod.BuildPath(Path_SM, realpath, sizeof(realpath), "%s", name);
|
g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
|
||||||
#ifdef PLATFORM_WINDOWS
|
#ifdef PLATFORM_WINDOWS
|
||||||
struct _stat s;
|
struct _stat s;
|
||||||
if (_stat(realpath, &s) != 0)
|
if (_stat(realpath, &s) != 0)
|
||||||
@ -311,9 +311,9 @@ static cell_t sm_RenameFile(IPluginContext *pContext, const cell_t *params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char new_realpath[PLATFORM_MAX_PATH+1];
|
char new_realpath[PLATFORM_MAX_PATH+1];
|
||||||
g_SourceMod.BuildPath(Path_SM, new_realpath, sizeof(new_realpath), "%s", newpath);
|
g_SourceMod.BuildPath(Path_Game, new_realpath, sizeof(new_realpath), "%s", newpath);
|
||||||
char old_realpath[PLATFORM_MAX_PATH+1];
|
char old_realpath[PLATFORM_MAX_PATH+1];
|
||||||
g_SourceMod.BuildPath(Path_SM, old_realpath, sizeof(old_realpath), "%s", oldpath);
|
g_SourceMod.BuildPath(Path_Game, old_realpath, sizeof(old_realpath), "%s", oldpath);
|
||||||
|
|
||||||
#ifdef PLATFORM_WINDOWS
|
#ifdef PLATFORM_WINDOWS
|
||||||
return (MoveFileA(old_realpath, new_realpath)) ? 1 : 0;
|
return (MoveFileA(old_realpath, new_realpath)) ? 1 : 0;
|
||||||
@ -333,7 +333,7 @@ static cell_t sm_DirExists(IPluginContext *pContext, const cell_t *params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char realpath[PLATFORM_MAX_PATH+1];
|
char realpath[PLATFORM_MAX_PATH+1];
|
||||||
g_SourceMod.BuildPath(Path_SM, realpath, sizeof(realpath), "%s", name);
|
g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
|
||||||
#ifdef PLATFORM_WINDOWS
|
#ifdef PLATFORM_WINDOWS
|
||||||
struct _stat s;
|
struct _stat s;
|
||||||
if (_stat(realpath, &s) != 0)
|
if (_stat(realpath, &s) != 0)
|
||||||
@ -370,7 +370,7 @@ static cell_t sm_FileSize(IPluginContext *pContext, const cell_t *params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char realpath[PLATFORM_MAX_PATH+1];
|
char realpath[PLATFORM_MAX_PATH+1];
|
||||||
g_SourceMod.BuildPath(Path_SM, realpath, sizeof(realpath), "%s", name);
|
g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
|
||||||
#ifdef PLATFORM_WINDOWS
|
#ifdef PLATFORM_WINDOWS
|
||||||
struct _stat s;
|
struct _stat s;
|
||||||
if (_stat(realpath, &s) != 0)
|
if (_stat(realpath, &s) != 0)
|
||||||
@ -407,7 +407,7 @@ static cell_t sm_RemoveDir(IPluginContext *pContext, const cell_t *params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char realpath[PLATFORM_MAX_PATH+1];
|
char realpath[PLATFORM_MAX_PATH+1];
|
||||||
g_SourceMod.BuildPath(Path_SM, realpath, sizeof(realpath), "%s", name);
|
g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
|
||||||
|
|
||||||
return (rmdir(realpath)) ? 0 : 1;
|
return (rmdir(realpath)) ? 0 : 1;
|
||||||
}
|
}
|
||||||
@ -516,8 +516,8 @@ REGISTER_NATIVES(filesystem)
|
|||||||
{"RemoveDir", sm_RemoveDir},
|
{"RemoveDir", sm_RemoveDir},
|
||||||
{"WriteFileLine", sm_WriteFileLine},
|
{"WriteFileLine", sm_WriteFileLine},
|
||||||
{"BuildPath", sm_BuildPath},
|
{"BuildPath", sm_BuildPath},
|
||||||
{"LogToGame", sm_LogToGame},
|
{"LogToGame", sm_LogToGame},
|
||||||
{"LogMessage", sm_LogMessage},
|
{"LogMessage", sm_LogMessage},
|
||||||
{"LogError", sm_LogError},
|
{"LogError", sm_LogError},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user