mirror of
https://github.com/dborth/fceugx.git
synced 2024-10-31 22:45:05 +01:00
automatically create screenshots dir if it doesn't exist
This commit is contained in:
parent
70ce1b8239
commit
cd7248af31
@ -699,6 +699,20 @@ ParseDirectory(bool waitParse, bool filter)
|
||||
return browser.numEntries;
|
||||
}
|
||||
|
||||
bool CreateDirectory(char * path)
|
||||
{
|
||||
DIR *dir = opendir(path);
|
||||
if (!dir) {
|
||||
if(mkdir(path, 0777) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
closedir(dir);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* AllocSaveBuffer ()
|
||||
* Clear and allocate the savebuffer
|
||||
|
@ -32,6 +32,7 @@ void CreateAppPath(char * origpath);
|
||||
bool GetFileSize(int i);
|
||||
void FindAndSelectLastLoadedFile();
|
||||
int ParseDirectory(bool waitParse = false, bool filter = true);
|
||||
bool CreateDirectory(char * path);
|
||||
void AllocSaveBuffer();
|
||||
void FreeSaveBuffer();
|
||||
size_t LoadFile(char * rbuffer, char *filepath, size_t length, bool silent);
|
||||
|
@ -580,8 +580,6 @@ bool LoadPrefs()
|
||||
sprintf(filepath[1], "cardb:/%s", APPFOLDER);
|
||||
#endif
|
||||
|
||||
printf("in load prefs\n");
|
||||
|
||||
for(int i=0; i<numDevices; i++)
|
||||
{
|
||||
prefFound = LoadPrefsFromMethod(filepath[i]);
|
||||
@ -595,6 +593,13 @@ bool LoadPrefs()
|
||||
if(prefFound)
|
||||
FixInvalidSettings();
|
||||
|
||||
// attempt to create screenshots directory if it doesn't exist
|
||||
if(GCSettings.LoadMethod != DEVICE_AUTO) {
|
||||
char dirPath[MAXPATHLEN];
|
||||
sprintf(dirPath, "%s%s", pathPrefix[GCSettings.LoadMethod], GCSettings.ScreenshotsFolder);
|
||||
CreateDirectory(dirPath);
|
||||
}
|
||||
|
||||
ResetText();
|
||||
return prefFound;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user