This commit is contained in:
Glenn Maynard
2004-08-30 04:49:57 +00:00
parent cf9b4af6cb
commit 463c81d7f1
3 changed files with 11 additions and 11 deletions
+1 -1
View File
@@ -406,7 +406,7 @@ RageFileObj *RageFileDriverZip::Open( const CString &path, int mode, RageFile &p
return NULL; return NULL;
} }
File *f = FDB->GetFile( path ); const File *f = FDB->GetFile( path );
if( f == NULL ) if( f == NULL )
{ {
err = ENOENT; err = ENOENT;
+8 -8
View File
@@ -115,7 +115,7 @@ RageFileManager::FileType FilenameDB::GetFileType( const CString &sPath )
if( Name == "." ) if( Name == "." )
return RageFileManager::TYPE_DIR; return RageFileManager::TYPE_DIR;
FileSet *fs = GetFileSet( Dir ); const FileSet *fs = GetFileSet( Dir );
return fs->GetFileType( Name ); return fs->GetFileType( Name );
} }
@@ -124,7 +124,7 @@ int FilenameDB::GetFileSize( const CString &sPath )
{ {
CString Dir, Name; CString Dir, Name;
SplitPath(sPath, Dir, Name); SplitPath(sPath, Dir, Name);
FileSet *fs = GetFileSet( Dir ); const FileSet *fs = GetFileSet( Dir );
return fs->GetFileSize(Name); return fs->GetFileSize(Name);
} }
@@ -132,7 +132,7 @@ int FilenameDB::GetFileHash( const CString &sPath )
{ {
CString Dir, Name; CString Dir, Name;
SplitPath(sPath, Dir, Name); SplitPath(sPath, Dir, Name);
FileSet *fs = GetFileSet( Dir ); const FileSet *fs = GetFileSet( Dir );
return fs->GetFileHash(Name); return fs->GetFileHash(Name);
} }
@@ -147,7 +147,7 @@ bool FilenameDB::ResolvePath(CString &path)
/* Resolve each component. */ /* Resolve each component. */
CString ret = ""; CString ret = "";
FileSet *fs = NULL; const FileSet *fs = NULL;
File *prev_file = NULL; File *prev_file = NULL;
static const CString slash("/"); static const CString slash("/");
while( 1 ) while( 1 )
@@ -162,7 +162,7 @@ bool FilenameDB::ResolvePath(CString &path)
CString p = path.substr( begin, size ); CString p = path.substr( begin, size );
ASSERT_M( p.size() != 1 || p[0] != '.', path ); // no . ASSERT_M( p.size() != 1 || p[0] != '.', path ); // no .
ASSERT_M( p.size() != 2 || p[0] != '.' || p[1] != '.', path ); // no .. ASSERT_M( p.size() != 2 || p[0] != '.' || p[1] != '.', path ); // no ..
set<File>::iterator it = fs->files.find( File(p) ); set<File>::const_iterator it = fs->files.find( File(p) );
/* If there were no matches, the path isn't found. */ /* If there were no matches, the path isn't found. */
if( it == fs->files.end() ) if( it == fs->files.end() )
@@ -188,13 +188,13 @@ bool FilenameDB::ResolvePath(CString &path)
void FilenameDB::GetFilesMatching(const CString &dir, const CString &beginning, const CString &containing, const CString &ending, vector<CString> &out, bool bOnlyDirs) void FilenameDB::GetFilesMatching(const CString &dir, const CString &beginning, const CString &containing, const CString &ending, vector<CString> &out, bool bOnlyDirs)
{ {
FileSet *fs = GetFileSet( dir ); const FileSet *fs = GetFileSet( dir );
fs->GetFilesMatching(beginning, containing, ending, out, bOnlyDirs); fs->GetFilesMatching(beginning, containing, ending, out, bOnlyDirs);
} }
void FilenameDB::GetFilesEqualTo(const CString &dir, const CString &fn, vector<CString> &out, bool bOnlyDirs) void FilenameDB::GetFilesEqualTo(const CString &dir, const CString &fn, vector<CString> &out, bool bOnlyDirs)
{ {
FileSet *fs = GetFileSet( dir ); const FileSet *fs = GetFileSet( dir );
fs->GetFilesEqualTo(fn, out, bOnlyDirs); fs->GetFilesEqualTo(fn, out, bOnlyDirs);
} }
@@ -369,7 +369,7 @@ void FilenameDB::FlushDirCache()
dirs.clear(); dirs.clear();
} }
File *FilenameDB::GetFile( const CString &sPath ) const File *FilenameDB::GetFile( const CString &sPath )
{ {
CString Dir, Name; CString Dir, Name;
SplitPath(sPath, Dir, Name); SplitPath(sPath, Dir, Name);
+2 -2
View File
@@ -30,7 +30,7 @@ struct File
/* If this is non-NULL, and dir is true, this is a pointer to the FileSet containing /* If this is non-NULL, and dir is true, this is a pointer to the FileSet containing
* the directory contents. (This is a cache; it isn't always set.) */ * the directory contents. (This is a cache; it isn't always set.) */
FileSet *dirp; const FileSet *dirp;
File() { dir=false; dirp=NULL; size=-1; hash=-1; priv=NULL;} File() { dir=false; dirp=NULL; size=-1; hash=-1; priv=NULL;}
File( const CString &fn ) File( const CString &fn )
@@ -92,7 +92,7 @@ public:
void AddFile( const CString &sPath, int size, int hash, void *priv=NULL ); void AddFile( const CString &sPath, int size, int hash, void *priv=NULL );
void DelFile( const CString &sPath ); void DelFile( const CString &sPath );
File *GetFile( const CString &path ); const File *GetFile( const CString &path );
/* This handles at most two * wildcards. If we need anything more complicated, /* This handles at most two * wildcards. If we need anything more complicated,
* we'll need to use fnmatch or regex. */ * we'll need to use fnmatch or regex. */