remove TTYPE_FILE, TTYPE_DIR, TTYPE_NONE

This commit is contained in:
Glenn Maynard
2004-01-06 05:44:28 +00:00
parent afd42bc90f
commit 05b5ab8a1d
3 changed files with 12 additions and 13 deletions
+3 -3
View File
@@ -261,7 +261,7 @@ bool RageFileDriverDirect::Remove( const CString &path )
FDB->ResolvePath( sPath ); FDB->ResolvePath( sPath );
switch( this->GetFileType(sPath) ) switch( this->GetFileType(sPath) )
{ {
case TTYPE_FILE: case RageFileManager::TYPE_FILE:
LOG->Trace("remove '%s'", (root + sPath).c_str()); LOG->Trace("remove '%s'", (root + sPath).c_str());
if( DoRemove( root + sPath ) == -1 ) if( DoRemove( root + sPath ) == -1 )
{ {
@@ -272,7 +272,7 @@ bool RageFileDriverDirect::Remove( const CString &path )
FDB->DelFile( sPath ); FDB->DelFile( sPath );
return true; return true;
case TTYPE_DIR: case RageFileManager::TYPE_DIR:
LOG->Trace("rmdir '%s'", (root + sPath).c_str()); LOG->Trace("rmdir '%s'", (root + sPath).c_str());
if( DoRmdir( root + sPath ) == -1 ) if( DoRmdir( root + sPath ) == -1 )
{ {
@@ -283,7 +283,7 @@ bool RageFileDriverDirect::Remove( const CString &path )
FDB->DelFile( sPath ); FDB->DelFile( sPath );
return true; return true;
case TTYPE_NONE: return false; case RageFileManager::TYPE_NONE: return false;
default: ASSERT(0); return false; default: ASSERT(0); return false;
} }
} }
+5 -5
View File
@@ -52,13 +52,13 @@ void FileSet::GetFilesEqualTo(const CString &str, vector<CString> &out, bool bOn
out.push_back( i->name ); out.push_back( i->name );
} }
FileType FileSet::GetFileType(const CString &path ) const RageFileManager::FileType FileSet::GetFileType(const CString &path ) const
{ {
set<File>::const_iterator i = files.find( File(path) ); set<File>::const_iterator i = files.find( File(path) );
if(i == files.end()) if(i == files.end())
return TTYPE_NONE; return RageFileManager::TYPE_NONE;
return i->dir? TTYPE_DIR:TTYPE_FILE; return i->dir? RageFileManager::TYPE_DIR:RageFileManager::TYPE_FILE;
} }
int FileSet::GetFileSize(const CString &path) const int FileSet::GetFileSize(const CString &path) const
@@ -101,13 +101,13 @@ static void SplitPath( CString Path, CString &Dir, CString &Name )
} }
FileType FilenameDB::GetFileType( const CString &sPath ) RageFileManager::FileType FilenameDB::GetFileType( const CString &sPath )
{ {
CString Dir, Name; CString Dir, Name;
SplitPath( sPath, Dir, Name ); SplitPath( sPath, Dir, Name );
if( Name == "." ) if( Name == "." )
return TTYPE_DIR; return RageFileManager::TYPE_DIR;
FileSet *fs = GetFileSet( Dir ); FileSet *fs = GetFileSet( Dir );
return fs->GetFileType( Name ); return fs->GetFileType( Name );
+4 -5
View File
@@ -4,8 +4,7 @@
#include <set> #include <set>
#include <map> #include <map>
#include "RageTimer.h" #include "RageTimer.h"
#include "RageFileManager.h"
enum FileType { TTYPE_FILE, TTYPE_DIR, TTYPE_NONE };
struct FileSet; struct FileSet;
struct File struct File
@@ -16,7 +15,7 @@ struct File
void SetName( const CString &fn ) void SetName( const CString &fn )
{ {
name = fn; name = fn;
lname = name; lname = name;
lname.MakeLower(); lname.MakeLower();
} }
@@ -62,7 +61,7 @@ struct FileSet
vector<CString> &out, bool bOnlyDirs) const; vector<CString> &out, bool bOnlyDirs) const;
void GetFilesEqualTo(const CString &pat, vector<CString> &out, bool bOnlyDirs) const; void GetFilesEqualTo(const CString &pat, vector<CString> &out, bool bOnlyDirs) const;
FileType GetFileType( const CString &path ) const; RageFileManager::FileType GetFileType( const CString &path ) const;
int GetFileSize(const CString &path) const; int GetFileSize(const CString &path) const;
int GetFileHash(const CString &path) const; int GetFileHash(const CString &path) const;
}; };
@@ -103,7 +102,7 @@ public:
* case. If "path" doesn't exist at all, return false and don't change it. */ * case. If "path" doesn't exist at all, return false and don't change it. */
bool ResolvePath(CString &path); bool ResolvePath(CString &path);
FileType GetFileType( const CString &path ); RageFileManager::FileType GetFileType( const CString &path );
int GetFileSize(const CString &path); int GetFileSize(const CString &path);
int GetFileHash( const CString &sFilePath ); int GetFileHash( const CString &sFilePath );
void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs, bool bReturnPathToo ); void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs, bool bReturnPathToo );