25 : m_WorkingDirectory(
"/" ), m_ValidatedCount( 0 )
27 InvalidateSystemPath();
40 if ( pFileSystem )
delete pFileSystem;
45 if ( pFileSystem )
delete pFileSystem;
50 if ( pFileSystem )
delete pFileSystem;
55 if ( pFileSystem )
delete pFileSystem;
67 m_Invalidated.InsertTail( a_pFileSystem );
68 InvalidateSystemPath();
76 if ( pFileSystem ==
TNULL )
89 if ( pFileSystem->GetName() == name )
103 ValidateSystemPath();
111 fsName.
Copy( a_sName, pos );
116 if ( pFileSystem !=
TNULL )
118 return pFileSystem->
CreateFile( fileName, flags );
124 TFile* pFile = pFileSystem->CreateFile( a_sName, flags );
126 if ( pFile !=
TNULL )
140 ValidateSystemPath();
141 TINT pos = a_strPath.
Find(
':', 0 );
148 fsName.
Copy( a_strPath, pos );
153 if ( pFileSystem !=
TNULL )
155 return pFileSystem->
ToNative( fileName, a_rNativeInfo );
160 if ( m_ValidatedCount != 1 )
164 if ( pFile !=
TNULL )
169 return pFileSystem->
ToNative( a_strPath, a_rNativeInfo );
176 return pFileSystem->
ToNative( a_strPath, a_rNativeInfo );
180void TFileManager::ValidateSystemPath()
182 if ( !m_IsValidated )
185 for (
auto pFS = m_Validated.
Tail(); pFS != m_Validated.
End(); pFS = m_Validated.
Tail() )
191 m_ValidatedCount = 0;
196 TBOOL hasPath = pathIter.First( fsName );
205 m_Validated.InsertTail( pFS );
206 m_ValidatedCount += 1;
209 hasPath = pathIter.Next( fsName );
212 m_IsValidated =
TTRUE;
217 : m_String( str ), m_Position( -1 )
222 : m_String( other.m_String ), m_Position( other.m_Position )
228 if ( m_String.Length() > 0 )
230 m_Position = m_String.Find(
';', 0 );
231 path.
Copy( m_String, m_Position );
244 if ( m_Position >= 0 )
246 TINT strStart = m_Position + 1;
247 m_Position = m_String.Find(
';', strStart );
250 m_String.GetString( strStart ),
251 ( m_Position >= 0 ) ? ( m_Position - strStart ) : -1
269void TFileManager::CreateCommon()
276void TFileManager::DestroyCommon()
Core file system interface for the Toshi engine.
#define TOSHI_NAMESPACE_START
#define TOSHI_NAMESPACE_END
#define T2_FOREACH(vecName, iteratorName)
virtual void DestroyFile(TFile *a_pFile)=0
Destroys specified file.
virtual TBOOL ToNative(const TString8 &a_rcPath, TNativeFileInfo &a_rOutInfo)
Fetches info about the path and returns internal path.
const TString8 & GetName() const
virtual TFile * CreateFile(const TString8 &a_rcFileName, TFILEMODE a_eFileMode)=0
Creates file.
static TString8 ConcatPath(const TString8 &a_rcPath1, const TString8 &a_rcPath2)
TFileSystem * GetFileSystem() const
TFileSystem * FindFileSystem(const TString8 &name)
TString8 MakeAbsolutePath(const TString8 &a_rcRelativePath) const
TFile * CreateFile(const TString8 &a_strName, TFILEMODE flags)
void MountFileSystem(TFileSystem *a_pFileSystem)
TBOOL GetFileInfo(const TString8 &a_strPath, TNativeFileInfo &a_rNativeInfo)
TBOOL Next(TString8 &path)
TSysPathIter(const TString8 &str)
TBOOL First(TString8 &path)
void InsertHead(TNode *a_pNode)
static TFORCEINLINE TFileManager * CreateSingleton(Args &&... args)
static TFORCEINLINE TFileManager * GetSingletonSafe()
TINT Find(TCHAR character, TINT pos=0) const
void Copy(const TString8 &src, TINT size=-1)
const TCHAR * GetString(TINT a_iIndex=0) const