Allow alternate directory for built-in symbols (#1230)

* allow an alternate directory for built-in symbol tables -- needed because macOS apps are a bundle (tree of directories) and resources are packaged somewhere within, not necessarily in the same directory as the executable.
* use tabs
* add parentheses
This commit is contained in:
sh95014 2023-06-02 09:28:04 -07:00 committed by GitHub
parent 0d635d2817
commit e5c4e2c51b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View File

@ -61,6 +61,7 @@ AppMode_e g_nAppMode = MODE_LOGO;
std::string g_sStartDir; // NB. AppleWin.exe maybe relative to this! (GH#663)
std::string g_sProgramDir; // Directory of where AppleWin executable resides
std::string g_sCurrentDir; // Also Starting Dir. Debugger uses this when load/save
std::string g_sBuiltinSymbolsDir; // Alternate directory for built-in debug symbols
bool g_bRestart = false;

View File

@ -38,6 +38,7 @@ extern AppMode_e g_nAppMode;
extern std::string g_sStartDir;
extern std::string g_sProgramDir;
extern std::string g_sCurrentDir;
extern std::string g_sBuiltinSymbolsDir;
bool SetCurrentImageDir(const std::string& pszImageDir);

View File

@ -749,8 +749,15 @@ Update_t CmdSymbolsLoad (int nArgs)
// Debugger will call us with 0 args on startup as a way to pre-load symbol tables
if (! nArgs)
{
sFileName += g_sFileNameSymbols[ iSymbolTable ];
sFileName = g_sProgramDir + g_sFileNameSymbols[ iSymbolTable ];
nSymbols = ParseSymbolTable( sFileName, (SymbolTable_Index_e) iSymbolTable );
// Try optional alternate location
if ((nSymbols == 0) && !g_sBuiltinSymbolsDir.empty())
{
sFileName = g_sBuiltinSymbolsDir + g_sFileNameSymbols[ iSymbolTable ];
nSymbols = ParseSymbolTable( sFileName, (SymbolTable_Index_e) iSymbolTable );
}
}
int iArg = 1;