Adding Mac SDX paths

This commit is contained in:
fekt
2023-03-03 20:20:47 -05:00
parent 883e598994
commit ac413ecb2e

View File

@@ -809,9 +809,7 @@ bool files_exist(boost::filesystem::path file1, boost::filesystem::path file2) {
return boost::filesystem::exists(file1) && boost::filesystem::exists(file2);
}
static void ZC_LoadParams(
const CChainParams& chainparams
)
static void ZC_LoadParams(const CChainParams& chainparams)
{
namespace fs = boost::filesystem;
struct timeval tv_start, tv_end;
@@ -875,7 +873,17 @@ static void ZC_LoadParams(
}
if (!found) {
// DMG Support: Apple just has to do things differently...
// This will only work when SDX is installed into /Applications, which is the only supported method
sapling_spend = boost::filesystem::path("/Applications/silentdragonx.app/Contents/MacOS") / "sapling-spend.params";
sapling_output = boost::filesystem::path("/Applications/silentdragonx.app/Contents/MacOS") / "sapling-output.params";
if (files_exist(sapling_spend, sapling_output)) {
LogPrintf("Found sapling params in /Applications/Contents/MacOS\n");
found = true;
}
}
if (!found) {
// SD DMG Support: Apple just has to do things differently...
sapling_spend = boost::filesystem::path("./silentdragon.app/Contents/MacOS") / "sapling-spend.params";
sapling_output = boost::filesystem::path("./silentdragon.app/Contents/MacOS") / "sapling-output.params";
if (files_exist(sapling_spend, sapling_output)) {
@@ -884,6 +892,16 @@ static void ZC_LoadParams(
}
}
if (!found) {
// SDX DMG Support: Apple just has to do things differently...
sapling_spend = boost::filesystem::path("./silentdragonx.app/Contents/MacOS") / "sapling-spend.params";
sapling_output = boost::filesystem::path("./silentdragonx.app/Contents/MacOS") / "sapling-output.params";
if (files_exist(sapling_spend, sapling_output)) {
LogPrintf("Found sapling params in /Applications/Contents/MacOS\n");
found = true;
}
}
if (!found) {
// The traditional place Zcash params are stored, should not hit this case in normal circumstances,
// as Hush packages sapling params now
@@ -1158,6 +1176,13 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
if(fs::exists(asmap_path)) {
printf("%s: found asmap file at %s\n", __func__, asmap_path.c_str() );
} else {
// Mac SDX
asmap_path = fs::path("/Applications/SilentDragonX.app/Contents/MacOS/") / DEFAULT_ASMAP_FILENAME;
printf("%s: looking for asmap file at %s\n", __func__, asmap_path.c_str() );
if(fs::exists(asmap_path)) {
printf("%s: found asmap file at %s\n", __func__, asmap_path.c_str() );
}
else {
// Shit is fucked up, die an honorable death
InitError(strprintf(_("Could not find any asmap file! Please report this bug to Hush Developers")));
return false;
@@ -1166,6 +1191,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
}
}
}
}
} else {
if (!asmap_path.is_absolute()) {
asmap_path = GetDataDir() / asmap_path;