Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Game creates automatically missing folder #122

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/qcommon/files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "qcommon.h"
#include "unzip.h"
#include "vm.h"
#include <sys/stat.h>

#ifndef DEDICATED
#include "client/cl_rest.h"
Expand Down Expand Up @@ -450,17 +451,24 @@ bool FS_OpenBaseGamePath( const char *baseGamePath )
{
const char *homePath = Sys_DefaultHomePath( );
const char *path;
struct stat st;

if (!homePath || !homePath[0])
{
homePath = fs_basepath->string;
}

path = FS_BuildOSPath( homePath, fs_basegame->string, baseGamePath);

if( FS_OpenWithDefault( path ) )
if(stat(path, &st) == 0 && !S_ISDIR(st.st_mode)) {
if( FS_OpenWithDefault( path ))
return true;
} else {
FS_CreatePath(path);
}

if( FS_OpenWithDefault( path ))
return true;

Com_Printf( S_COLOR_RED "FS_BrowseHomepath: failed to open the homepath with the default file manager.\n" S_COLOR_WHITE );
return false;
}
Expand Down