Browse Source

Adding Mac SDX paths

pull/279/head
fekt 1 year ago
parent
commit
ac413ecb2e
  1. 54
      src/init.cpp

54
src/init.cpp

@ -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;
@ -841,18 +839,18 @@ static void ZC_LoadParams(
if (files_exist(sapling_spend, sapling_output)) {
LogPrintf("Found sapling params in /usr/share/hush\n");
found=true;
}
}
}
}
if (!found) {
if (!found) {
// Try ..
sapling_spend = boost::filesystem::path("..") / "sapling-spend.params";
sapling_output = boost::filesystem::path("..") / "sapling-output.params";
if (files_exist(sapling_spend, sapling_output)) {
LogPrintf("Found sapling params in ..\n");
found = true;
}
}
}
if (!found) {
// This will catch the case of any external software (i.e. GUI wallets) needing params and installed in same dir as hush3.git
@ -861,7 +859,7 @@ static void ZC_LoadParams(
if (files_exist(sapling_spend, sapling_output)) {
LogPrintf("Found sapling params in ../hush3\n");
found = true;
}
}
}
if (!found) {
@ -871,17 +869,37 @@ static void ZC_LoadParams(
if (files_exist(sapling_spend, sapling_output)) {
LogPrintf("Found sapling params in /Applications/Contents/MacOS\n");
found = true;
}
}
if (!found) {
// 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) {
// DMG Support: Apple just has to do things differently...
// 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)) {
LogPrintf("Found sapling params in /Applications/Contents/MacOS\n");
found = true;
}
}
}
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) {
@ -893,7 +911,7 @@ static void ZC_LoadParams(
LogPrintf("Found sapling params in ~/.zcash\n");
found = true;
}
}
}
if (!found) {
// No Sapling params, at least we tried
@ -1158,9 +1176,17 @@ 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 {
// 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;
// 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;
}
}
}
}

Loading…
Cancel
Save