mirror of
https://github.com/UberGames/GtkRadiant.git
synced 2024-11-29 07:02:26 +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;
|
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 ) {
|
EPathCheck CheckFile( const char *path ) {
|
||||||
struct _stat sbuf;
|
DWORD Attrib = GetFileAttributes( path );
|
||||||
if ( _stat( path, &sbuf ) == -1 ) {
|
if ( Attrib == INVALID_FILE_ATTRIBUTES ) {
|
||||||
return PATH_FAIL;
|
return PATH_FAIL;
|
||||||
}
|
}
|
||||||
if ( ( sbuf.st_mode & _S_IFDIR ) != 0 ) {
|
if ( Attrib & FILE_ATTRIBUTE_DIRECTORY ) {
|
||||||
return PATH_DIRECTORY;
|
return PATH_DIRECTORY;
|
||||||
}
|
}
|
||||||
return PATH_FILE;
|
return PATH_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool radCreateDirectory( const char *directory, bool fatal_on_error ) {
|
bool radCreateDirectory( const char *directory, bool fatal_on_error ) {
|
||||||
|
|
|
@ -3413,15 +3413,11 @@ void CGameInstall::Run() {
|
||||||
|
|
||||||
// write out the game file
|
// write out the game file
|
||||||
Str gameFilePath = g_strAppPath.GetBuffer();
|
Str gameFilePath = g_strAppPath.GetBuffer();
|
||||||
gameFilePath += "games";
|
gameFilePath += "games/";
|
||||||
if ( CheckFile( gameFilePath ) != PATH_DIRECTORY ) {
|
if ( CheckFile( gameFilePath ) != PATH_DIRECTORY ) {
|
||||||
radCreateDirectory( gameFilePath );
|
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 ] ) {
|
switch ( m_availGames[ m_nComboSelect ] ) {
|
||||||
case GAME_Q2:
|
case GAME_Q2:
|
||||||
gameFilePath += "q2.game";
|
gameFilePath += "q2.game";
|
||||||
|
|
Loading…
Reference in a new issue