mirror of
https://github.com/UberGames/GtkRadiant.git
synced 2024-11-22 03:41:39 +00:00
QBall proposed a better solution for this
This commit is contained in:
parent
686527fdbc
commit
000dd45943
2 changed files with 9 additions and 15 deletions
|
@ -227,17 +227,15 @@ const char* FindFiles::NextFile() {
|
|||
return findFileData.cFileName;
|
||||
}
|
||||
|
||||
// NOTE: has a problem when trailing (back)slashes are present (different behavior than the nix implementation)
|
||||
// https://github.com/TTimo/GtkRadiant/issues/87
|
||||
EPathCheck CheckFile( const char *path ) {
|
||||
struct _stat sbuf;
|
||||
if ( _stat( path, &sbuf ) == -1 ) {
|
||||
return PATH_FAIL;
|
||||
}
|
||||
if ( ( sbuf.st_mode & _S_IFDIR ) != 0 ) {
|
||||
return PATH_DIRECTORY;
|
||||
}
|
||||
return PATH_FILE;
|
||||
DWORD Attrib = GetFileAttributes( path );
|
||||
if ( Attrib == INVALID_FILE_ATTRIBUTES ) {
|
||||
return PATH_FAIL;
|
||||
}
|
||||
if ( Attrib & FILE_ATTRIBUTE_DIRECTORY ) {
|
||||
return PATH_DIRECTORY;
|
||||
}
|
||||
return PATH_FILE;
|
||||
}
|
||||
|
||||
bool radCreateDirectory( const char *directory, bool fatal_on_error ) {
|
||||
|
|
|
@ -3413,15 +3413,11 @@ void CGameInstall::Run() {
|
|||
|
||||
// write out the game file
|
||||
Str gameFilePath = g_strAppPath.GetBuffer();
|
||||
gameFilePath += "games";
|
||||
gameFilePath += "games/";
|
||||
if ( CheckFile( gameFilePath ) != PATH_DIRECTORY ) {
|
||||
radCreateDirectory( gameFilePath );
|
||||
}
|
||||
|
||||
// QB - Fix for when you have more than one game configured (before it just bombed out due to the dir already existing).
|
||||
// add the slash here instead of above else CheckFile() fails hard (on windows at least :/ )
|
||||
gameFilePath += "/";
|
||||
|
||||
switch ( m_availGames[ m_nComboSelect ] ) {
|
||||
case GAME_Q2:
|
||||
gameFilePath += "q2.game";
|
||||
|
|
Loading…
Reference in a new issue