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"> isEnabled = "YES">
</CommandLineArgument> </CommandLineArgument>
</CommandLineArguments> </CommandLineArguments>
<EnvironmentVariables>
<EnvironmentVariable
key = "MKXPZ_SELECT_PATH"
value = "1"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction> </LaunchAction>
<ProfileAction <ProfileAction
buildConfiguration = "Debug" buildConfiguration = "Debug"

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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