mirror of
https://github.com/dborth/snes9xgx.git
synced 2025-02-02 21:22:43 +01:00
automatically create preview image dirs if they don't exist
This commit is contained in:
parent
b66d66e82e
commit
6788d15aae
@ -699,6 +699,20 @@ ParseDirectory(bool waitParse, bool filter)
|
|||||||
return browser.numEntries;
|
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 ()
|
* AllocSaveBuffer ()
|
||||||
* Clear and allocate the savebuffer
|
* Clear and allocate the savebuffer
|
||||||
|
@ -37,6 +37,7 @@ void CreateAppPath(char * origpath);
|
|||||||
bool GetFileSize(int i);
|
bool GetFileSize(int i);
|
||||||
void FindAndSelectLastLoadedFile();
|
void FindAndSelectLastLoadedFile();
|
||||||
int ParseDirectory(bool waitParse = false, bool filter = true);
|
int ParseDirectory(bool waitParse = false, bool filter = true);
|
||||||
|
bool CreateDirectory(char * path);
|
||||||
void AllocSaveBuffer();
|
void AllocSaveBuffer();
|
||||||
void FreeSaveBuffer();
|
void FreeSaveBuffer();
|
||||||
size_t LoadFile(char * rbuffer, char *filepath, size_t length, bool silent);
|
size_t LoadFile(char * rbuffer, char *filepath, size_t length, bool silent);
|
||||||
|
@ -651,8 +651,9 @@ bool LoadPrefs()
|
|||||||
|
|
||||||
prefLoaded = true; // attempted to load preferences
|
prefLoaded = true; // attempted to load preferences
|
||||||
|
|
||||||
if(prefFound)
|
if(prefFound) {
|
||||||
FixInvalidSettings();
|
FixInvalidSettings();
|
||||||
|
}
|
||||||
|
|
||||||
// rename snes9x to snes9xgx
|
// rename snes9x to snes9xgx
|
||||||
if(GCSettings.LoadMethod == DEVICE_SD)
|
if(GCSettings.LoadMethod == DEVICE_SD)
|
||||||
@ -690,6 +691,17 @@ bool LoadPrefs()
|
|||||||
if(strcmp(GCSettings.ArtworkFolder, "snes9x/artworks") == 0)
|
if(strcmp(GCSettings.ArtworkFolder, "snes9x/artworks") == 0)
|
||||||
sprintf(GCSettings.ArtworkFolder, "snes9xgx/artworks");
|
sprintf(GCSettings.ArtworkFolder, "snes9xgx/artworks");
|
||||||
|
|
||||||
|
// attempt to create directories if they don't exist
|
||||||
|
if(GCSettings.LoadMethod != DEVICE_AUTO) {
|
||||||
|
char dirPath[MAXPATHLEN];
|
||||||
|
sprintf(dirPath, "%s%s", pathPrefix[GCSettings.LoadMethod], GCSettings.ScreenshotsFolder);
|
||||||
|
CreateDirectory(dirPath);
|
||||||
|
sprintf(dirPath, "%s%s", pathPrefix[GCSettings.LoadMethod], GCSettings.CoverFolder);
|
||||||
|
CreateDirectory(dirPath);
|
||||||
|
sprintf(dirPath, "%s%s", pathPrefix[GCSettings.LoadMethod], GCSettings.ArtworkFolder);
|
||||||
|
CreateDirectory(dirPath);
|
||||||
|
}
|
||||||
|
|
||||||
ResetText();
|
ResetText();
|
||||||
return prefFound;
|
return prefFound;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user