diff --git a/radiant/missing.cpp b/radiant/missing.cpp index 0255360..c220e62 100644 --- a/radiant/missing.cpp +++ b/radiant/missing.cpp @@ -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 ) { diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index 844e822..cea42e4 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -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";