mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 03:24:56 +08:00
filesystem: VFileSystem009: fix DeleteFile
This commit is contained in:
@@ -28,7 +28,7 @@ GNU General Public License for more details.
|
||||
// GoldSrc Directories and ID
|
||||
// GAME gamedir
|
||||
// GAMECONFIG gamedir (rodir integration?)
|
||||
// GAMEDOWNLOAD gamedir_downloads (gamedir/downloads for us)
|
||||
// GAMEDOWNLOAD gamedir_downloads
|
||||
// GAME_FALLBACK liblist.gam's fallback_dir
|
||||
// ROOT and BASE rootdir
|
||||
// PLATFORM platform
|
||||
@@ -41,14 +41,22 @@ GNU General Public License for more details.
|
||||
char * const var = static_cast<char *>( alloca( var ## _size )); \
|
||||
CopyAndFixSlashes( var, ( str ), var ## _size )
|
||||
|
||||
static inline bool IsIdGamedir( const char *id )
|
||||
static bool IsIdGamedir( const char *id )
|
||||
{
|
||||
return !Q_strcmp( id, "GAME" ) ||
|
||||
!Q_strcmp( id, "GAMECONFIG" ) ||
|
||||
!Q_strcmp( id, "GAMEDOWNLOAD" );
|
||||
}
|
||||
|
||||
static inline const char *IdToDir( char *dir, size_t size, const char *id )
|
||||
static searchpath_t *IdToWritableSearchpath( const char *id )
|
||||
{
|
||||
if( !Q_strcmp( id, "GAME" ) || !Q_strcmp( id, "GAMECONFIG" ))
|
||||
return fs_writepath;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *IdToDir( char *dir, size_t size, const char *id )
|
||||
{
|
||||
if( !Q_strcmp( id, "GAME" ))
|
||||
return GI->gamefolder;
|
||||
@@ -72,7 +80,7 @@ static inline const char *IdToDir( char *dir, size_t size, const char *id )
|
||||
return fs_rootdir; // give at least root directory
|
||||
}
|
||||
|
||||
static inline void CopyAndFixSlashes( char *p, const char *in, size_t size )
|
||||
static void CopyAndFixSlashes( char *p, const char *in, size_t size )
|
||||
{
|
||||
Q_strncpy( p, in, size );
|
||||
COM_FixSlashes( p );
|
||||
@@ -147,10 +155,9 @@ public:
|
||||
|
||||
void RemoveFile( const char *path, const char *id ) override
|
||||
{
|
||||
char dir[MAX_VA_STRING], fullpath[MAX_VA_STRING];
|
||||
|
||||
Q_snprintf( fullpath, sizeof( fullpath ), "%s/%s", IdToDir( dir, sizeof( dir ), id ), path );
|
||||
FS_Delete( fullpath ); // FS_Delete is aware of slashes
|
||||
// FIXME: handle writable downloads path
|
||||
if( IdToWritableSearchpath( id ))
|
||||
FS_Delete( path ); // FS_Delete is aware of slashes
|
||||
}
|
||||
|
||||
void CreateDirHierarchy( const char *path, const char *id ) override
|
||||
|
||||
Reference in New Issue
Block a user