37 TTRACE(
"TFile::Create - Created file %s with mode %hu\n", filename.
GetString(), mode );
41 TTRACE(
"TFile::Create - Failed to create file %s with mode %hu\n", filename.
GetString(), mode );
52 TINT iPath1StartPos = 0;
53 TINT iPath2StartPos = 0;
59 if ( iColonPos == -1 )
66 iPath1StartPos = iColonPos + 1;
67 strResult.
Concat( a_rcPath1, iPath1StartPos );
73 iPath2StartPos = iColonPos + 1;
74 strResult.
Concat( a_rcPath2, iPath2StartPos );
83 if ( iPath2StartPos < iPath2Length &&
84 ( a_rcPath2[ iPath2StartPos ] ==
'/' || a_rcPath2[ iPath2StartPos ] ==
'\\' ) )
87 strResult += a_rcPath2.
GetString( iPath2StartPos );
92 strResult += a_rcPath1.
GetString( iPath1StartPos );
93 if ( iPath1StartPos < iPath1Length && iPath2StartPos < iPath2Length &&
94 a_rcPath1[ iPath1Length - 1 ] !=
'/' && a_rcPath1[ iPath1Length - 1 ] !=
'\\' )
99 strResult += a_rcPath2.
GetString( iPath2StartPos );
116 if ( iColonPos > -1 )
118 iPos = iColonPos + 1;
119 strResult.
Concat( strPath, iPos );
122 if ( strPath[ iPos ] ==
'/' )
128 TINT iInitialResultLength = strResult.
Length();
129 TINT iResultLength = iInitialResultLength;
132 TINT iSlashPos = strPath.
Find(
'/', iPos );
139 if ( iInitialResultLength < strResult.
Length() )
147 if ( !strncmp( strPath.
GetString( iPos ),
"../", 3 ) )
149 if ( iResultLength == strResult.
Length() )
160 if ( strResult.
Length() > 1 && ( iTruncateTo = strResult.
FindReverse(
'/', strResult.
Length() - 2 ), iResultLength <= iTruncateTo ) )
162 strResult.
Truncate( iTruncateTo + 1 );
166 strResult.
Truncate( iResultLength );
171 else if ( strncmp( strPath.
GetString( iPos ),
"./", 2 ) != 0 )
173 strResult.
Concat( strPath.
GetString( iPos ), ( iSlashPos - iPos ) + 1 );
176 iPos = iSlashPos + 1;
177 iSlashPos = strPath.
Find(
'/', iPos );
187 m_pFileSystem->DestroyFile(
this );
Core file system interface for the Toshi engine.
#define TOSHI_NAMESPACE_START
#define TOSHI_NAMESPACE_END
void FixPathSlashesBack(TString8 &a_rPath)
static TString8 ConcatPath(const TString8 &a_rcPath1, const TString8 &a_rcPath2)
static TString8 SimplifyPath(const TString8 &a_rcPath)
static TFile * Create(const TString8 &a_rcFilename, TFILEMODE a_eMode=TFILEMODE_READ)
TFile(TFileSystem *a_pFS)
TFileSystem * GetFileSystem() const
TFile * CreateFile(const TString8 &a_strName, TFILEMODE flags)
static TFORCEINLINE TFileManager * GetSingletonSafe()
TString8 & Concat(const TString8 &str, TINT size=-1)
TINT Find(TCHAR character, TINT pos=0) const
TINT FindReverse(TCHAR a_findChar, TINT pos=-1) const
TBOOL IsIndexValid(TINT a_iIndex) const
void Truncate(TINT length)
const TCHAR * GetString(TINT a_iIndex=0) const