mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-22 21:09:52 +00:00
Call CreateSysDirectories on all platforms.
This commit is contained in:
parent
5acb421908
commit
7a4efb1a0a
@ -707,18 +707,42 @@ Path GetSysDirectory(PSPDirectories directoryType) {
|
||||
}
|
||||
}
|
||||
|
||||
void CreateSysDirectories() {
|
||||
bool CreateSysDirectories() {
|
||||
#if PPSSPP_PLATFORM(ANDROID)
|
||||
const bool createNoMedia = true;
|
||||
#else
|
||||
const bool createNoMedia = false;
|
||||
#endif
|
||||
|
||||
Path pspDir = GetSysDirectory(DIRECTORY_PSP);
|
||||
INFO_LOG(IO, "Creating '%s' and subdirs:", pspDir.c_str());
|
||||
File::CreateDir(pspDir);
|
||||
if (!File::Exists(pspDir)) {
|
||||
INFO_LOG(IO, "Not a workable memstick directory. Giving up");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create the default directories that a real PSP creates. Good for homebrew so they can
|
||||
// expect a standard environment. Skipping THEME though, that's pointless.
|
||||
File::CreateDir(GetSysDirectory(DIRECTORY_PSP));
|
||||
File::CreateDir(GetSysDirectory(DIRECTORY_PSP) / "COMMON");
|
||||
File::CreateDir(GetSysDirectory(DIRECTORY_GAME));
|
||||
File::CreateDir(GetSysDirectory(DIRECTORY_SAVEDATA));
|
||||
File::CreateDir(GetSysDirectory(DIRECTORY_SAVESTATE));
|
||||
File::CreateDir(GetSysDirectory(DIRECTORY_SYSTEM));
|
||||
File::CreateDir(GetSysDirectory(DIRECTORY_TEXTURES));
|
||||
static const PSPDirectories sysDirs[] = {
|
||||
DIRECTORY_CHEATS,
|
||||
DIRECTORY_SAVEDATA,
|
||||
DIRECTORY_SAVESTATE,
|
||||
DIRECTORY_GAME,
|
||||
DIRECTORY_SYSTEM,
|
||||
DIRECTORY_TEXTURES,
|
||||
DIRECTORY_PLUGINS,
|
||||
DIRECTORY_CACHE,
|
||||
};
|
||||
|
||||
if (g_Config.currentDirectory.empty()) {
|
||||
g_Config.currentDirectory = GetSysDirectory(DIRECTORY_GAME);
|
||||
for (auto dir : sysDirs) {
|
||||
Path path = GetSysDirectory(dir);
|
||||
File::CreateFullPath(path);
|
||||
if (createNoMedia) {
|
||||
// Create a nomedia file in each specified subdirectory.
|
||||
File::CreateEmptyFile(path / ".nomedia");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ void UpdateLoadedFile(FileLoader *fileLoader);
|
||||
// they are not stored anywhere.
|
||||
Path GetSysDirectory(PSPDirectories directoryType);
|
||||
|
||||
void CreateSysDirectories();
|
||||
bool CreateSysDirectories();
|
||||
|
||||
// RUNNING must be at 0, NEXTFRAME must be at 1.
|
||||
enum CoreState {
|
||||
|
@ -290,14 +290,15 @@ static bool CheckFontIsUsable(const wchar_t *fontFace) {
|
||||
}
|
||||
#endif
|
||||
|
||||
bool CreateDirectoriesAndroid();
|
||||
|
||||
void PostLoadConfig() {
|
||||
// On Windows, we deal with currentDirectory in InitSysDirectories().
|
||||
#if !PPSSPP_PLATFORM(WINDOWS)
|
||||
if (g_Config.currentDirectory.empty()) {
|
||||
g_Config.currentDirectory = g_Config.defaultCurrentDirectory;
|
||||
}
|
||||
#else
|
||||
if (g_Config.currentDirectory.empty()) {
|
||||
g_Config.currentDirectory = GetSysDirectory(DIRECTORY_GAME);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Allow the lang directory to be overridden for testing purposes (e.g. Android, where it's hard to
|
||||
@ -310,51 +311,11 @@ void PostLoadConfig() {
|
||||
else
|
||||
g_i18nrepo.LoadIni(g_Config.sLanguageIni, langOverridePath);
|
||||
|
||||
#if PPSSPP_PLATFORM(ANDROID)
|
||||
CreateDirectoriesAndroid();
|
||||
#if !PPSSPP_PLATFORM(WINDOWS) && !PPSSPP_PLATFORM(UWP)
|
||||
CreateSysDirectories();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CreateDirectoriesAndroid() {
|
||||
// TODO: We should probably simply use this as the shared function to create memstick directories.
|
||||
#if PPSSPP_PLATFORM(ANDROID)
|
||||
const bool createNoMedia = true;
|
||||
#else
|
||||
const bool createNoMedia = false;
|
||||
#endif
|
||||
|
||||
Path pspDir = GetSysDirectory(DIRECTORY_PSP);
|
||||
|
||||
INFO_LOG(IO, "Creating '%s' and subdirs:", pspDir.c_str());
|
||||
File::CreateFullPath(pspDir);
|
||||
if (!File::Exists(pspDir)) {
|
||||
INFO_LOG(IO, "Not a workable memstick directory. Giving up");
|
||||
return false;
|
||||
}
|
||||
|
||||
static const PSPDirectories sysDirs[] = {
|
||||
DIRECTORY_CHEATS,
|
||||
DIRECTORY_SAVEDATA,
|
||||
DIRECTORY_SAVESTATE,
|
||||
DIRECTORY_GAME,
|
||||
DIRECTORY_SYSTEM,
|
||||
DIRECTORY_TEXTURES,
|
||||
DIRECTORY_PLUGINS,
|
||||
DIRECTORY_CACHE,
|
||||
};
|
||||
|
||||
for (auto dir : sysDirs) {
|
||||
Path path = GetSysDirectory(dir);
|
||||
File::CreateFullPath(path);
|
||||
if (createNoMedia) {
|
||||
// Create a nomedia file in each specified subdirectory.
|
||||
File::CreateEmptyFile(path / ".nomedia");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void CheckFailedGPUBackends() {
|
||||
#ifdef _DEBUG
|
||||
// If you're in debug mode, you probably don't want a fallback. If you're in release mode, use IGNORE below.
|
||||
|
Loading…
Reference in New Issue
Block a user