Skip to content

Commit

Permalink
Merge pull request #2499 from jamescowens/fix_boinc_path_for_flatpack
Browse files Browse the repository at this point in the history
util: Add flatpath BOINC data directory path resolution for Linux
  • Loading branch information
jamescowens authored Apr 24, 2022
2 parents d5d7035 + aee976f commit ec11d12
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/gridcoin/boinc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,25 @@ fs::path GRC::GetBoincDataDir()
#endif

#ifdef __linux__
// For Linux, native first, then flatpack...
if (fs::exists("/var/lib/boinc-client/")) {
return "/var/lib/boinc-client/";
} else if (fs::exists("/var/lib/boinc/")) {
return "/var/lib/boinc/";
}

// This is for flatpack path resolution
char* pszHome = getenv("HOME");

// If there is a home path then try the flatpack path.
if (pszHome && strlen(pszHome) > 0) {

fs::path flatpack_path = fs::path(pszHome) / ".var/app/edu.berkeley.BOINC/";

if (fs::exists(flatpack_path)) {
return flatpack_path;
}
}
#endif

#ifdef __APPLE__
Expand All @@ -68,6 +82,8 @@ fs::path GRC::GetBoincDataDir()
}
#endif

LogPrintf("ERROR: Cannot find BOINC data dir");
error("%s: Cannot find BOINC data directory. You may need to manually specify in the gridcoinresearch.conf file "
"the data directory location by using boincdatadir=<data directory location>.", __func__);

return "";
}

0 comments on commit ec11d12

Please sign in to comment.