Use path select based on env rather than Debug

Building a Release seems to just break newer versions of ANGLE,
so now let's just use Debug always.
the environment variable `MKXPZ_SELECT_PATH`
can be set to any value to bring up the option to select a path
This commit is contained in:
Struma 2022-01-16 22:56:58 -05:00
parent 822b3ae550
commit 8aa7fc7cc3
8 changed files with 48 additions and 19 deletions

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
<false/>
</dict>
</plist>

View file

@ -56,6 +56,13 @@
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
<EnvironmentVariables>
<EnvironmentVariable
key = "MKXPZ_SELECT_PATH"
value = "1"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction>
<ProfileAction
buildConfiguration = "Debug"

View file

@ -56,6 +56,13 @@
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
<EnvironmentVariables>
<EnvironmentVariable
key = "MKXPZ_SELECT_PATH"
value = "1"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction>
<ProfileAction
buildConfiguration = "Debug"

View file

@ -50,6 +50,13 @@
ReferencedContainer = "container:mkxp-z.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<EnvironmentVariables>
<EnvironmentVariable
key = "MKXPZ_SELECT_PATH"
value = "1"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

View file

@ -56,6 +56,13 @@
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
<EnvironmentVariables>
<EnvironmentVariable
key = "MKXPZ_SELECT_PATH"
value = "1"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction>
<ProfileAction
buildConfiguration = "Debug"
@ -78,7 +85,7 @@
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
buildConfiguration = "Debug"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View file

@ -30,10 +30,8 @@ std::string contentsOfAssetAsString(const char *baseName, const char *ext);
std::string getResourcePath();
#ifdef MKXPZ_DEBUG
std::string selectPath(SDL_Window *win, const char *msg, const char *prompt);
#endif
#endif
};
#endif /* filesystemImpl_h */

View file

@ -5,12 +5,8 @@
// Created by ゾロアーク on 11/21/20.
//
#ifdef MKXPZ_DEBUG
#import <AppKit/AppKit.h>
#import <SDL_syswm.h>
#else
#import <Foundation/Foundation.h>
#endif
#import <SDL_filesystem.h>
@ -100,7 +96,6 @@ std::string filesystemImpl::getResourcePath() {
return std::string(NSTOPATH(NSBundle.mainBundle.resourcePath));
}
#ifdef MKXPZ_DEBUG
std::string filesystemImpl::selectPath(SDL_Window *win, const char *msg, const char *prompt) {
NSOpenPanel *panel = [NSOpenPanel openPanel];
panel.canChooseDirectories = true;
@ -126,4 +121,3 @@ std::string filesystemImpl::selectPath(SDL_Window *win, const char *msg, const c
return std::string();
}
#endif

View file

@ -344,18 +344,19 @@ int main(int argc, char *argv[]) {
return 0;
}
#if defined(MKXPZ_BUILD_XCODE) && defined(MKXPZ_DEBUG)
#define DEBUG_FSELECT_MSG "Select the folder to load game files from. This is the folder containing the INI and/or configuration JSON.\nThis prompt does not appear in release builds."
#if defined(MKXPZ_BUILD_XCODE)
#define DEBUG_FSELECT_MSG "Select the folder to load game files from. This is the folder containing the INI and/or configuration JSON."
#define DEBUG_FSELECT_PROMPT "Load Game"
std::string dataDirStr = mkxp_fs::selectPath(win, DEBUG_FSELECT_MSG, DEBUG_FSELECT_PROMPT);
if (!dataDirStr.empty()) {
conf.gameFolder = dataDirStr;
mkxp_fs::setCurrentDirectory(dataDirStr.c_str());
Debug() << "DEBUG: Current directory set to" << dataDirStr;
conf.read(argc, argv);
conf.readGameINI();
if (SDL_getenv("MKXPZ_SELECT_PATH")) {
std::string dataDirStr = mkxp_fs::selectPath(win, DEBUG_FSELECT_MSG, DEBUG_FSELECT_PROMPT);
if (!dataDirStr.empty()) {
conf.gameFolder = dataDirStr;
mkxp_fs::setCurrentDirectory(dataDirStr.c_str());
Debug() << "DEBUG: Current directory set to" << dataDirStr;
conf.read(argc, argv);
conf.readGameINI();
}
}
#endif
/* OSX and Windows have their own native ways of