Changeset View
Changeset View
Standalone View
Standalone View
src/qt/guiutil.cpp
Show First 20 Lines • Show All 404 Lines • ▼ Show 20 Lines | void openDebugLogfile() { | ||||
} | } | ||||
} | } | ||||
bool openBitcoinConf() { | bool openBitcoinConf() { | ||||
fs::path pathConfig = | fs::path pathConfig = | ||||
GetConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME)); | GetConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME)); | ||||
/* Create the file */ | /* Create the file */ | ||||
fs::ofstream configFile(pathConfig, std::ios_base::app); | fsbridge::ofstream configFile(pathConfig, std::ios_base::app); | ||||
if (!configFile.good()) { | if (!configFile.good()) { | ||||
return false; | return false; | ||||
} | } | ||||
configFile.close(); | configFile.close(); | ||||
/* Open bitcoin.conf with the associated application */ | /* Open bitcoin.conf with the associated application */ | ||||
▲ Show 20 Lines • Show All 247 Lines • ▼ Show 20 Lines | static fs::path GetAutostartFilePath() { | ||||
std::string chain = gArgs.GetChainName(); | std::string chain = gArgs.GetChainName(); | ||||
if (chain == CBaseChainParams::MAIN) { | if (chain == CBaseChainParams::MAIN) { | ||||
return GetAutostartDir() / "bitcoin.desktop"; | return GetAutostartDir() / "bitcoin.desktop"; | ||||
} | } | ||||
return GetAutostartDir() / strprintf("bitcoin-%s.lnk", chain); | return GetAutostartDir() / strprintf("bitcoin-%s.lnk", chain); | ||||
} | } | ||||
bool GetStartOnSystemStartup() { | bool GetStartOnSystemStartup() { | ||||
fs::ifstream optionFile(GetAutostartFilePath()); | fsbridge::ifstream optionFile(GetAutostartFilePath()); | ||||
if (!optionFile.good()) { | if (!optionFile.good()) { | ||||
return false; | return false; | ||||
} | } | ||||
// Scan through file for "Hidden=true": | // Scan through file for "Hidden=true": | ||||
std::string line; | std::string line; | ||||
while (!optionFile.eof()) { | while (!optionFile.eof()) { | ||||
getline(optionFile, line); | getline(optionFile, line); | ||||
if (line.find("Hidden") != std::string::npos && | if (line.find("Hidden") != std::string::npos && | ||||
Show All 15 Lines | if (!fAutoStart) { | ||||
readlink("/proc/self/exe", pszExePath, sizeof(pszExePath) - 1); | readlink("/proc/self/exe", pszExePath, sizeof(pszExePath) - 1); | ||||
if (r == -1) { | if (r == -1) { | ||||
return false; | return false; | ||||
} | } | ||||
pszExePath[r] = '\0'; | pszExePath[r] = '\0'; | ||||
fs::create_directories(GetAutostartDir()); | fs::create_directories(GetAutostartDir()); | ||||
fs::ofstream optionFile(GetAutostartFilePath(), | fsbridge::ofstream optionFile( | ||||
std::ios_base::out | std::ios_base::trunc); | GetAutostartFilePath(), std::ios_base::out | std::ios_base::trunc); | ||||
if (!optionFile.good()) { | if (!optionFile.good()) { | ||||
return false; | return false; | ||||
} | } | ||||
std::string chain = gArgs.GetChainName(); | std::string chain = gArgs.GetChainName(); | ||||
// Write a bitcoin.desktop file to the autostart directory: | // Write a bitcoin.desktop file to the autostart directory: | ||||
optionFile << "[Desktop Entry]\n"; | optionFile << "[Desktop Entry]\n"; | ||||
optionFile << "Type=Application\n"; | optionFile << "Type=Application\n"; | ||||
if (chain == CBaseChainParams::MAIN) { | if (chain == CBaseChainParams::MAIN) { | ||||
▲ Show 20 Lines • Show All 272 Lines • Show Last 20 Lines |