diff --git a/installers/windows/Monero.iss b/installers/windows/Monero.iss index bdcfea30..98831d57 100644 --- a/installers/windows/Monero.iss +++ b/installers/windows/Monero.iss @@ -54,6 +54,9 @@ Name: "en"; MessagesFile: "compiler:Default.isl" ; Name: "nl"; MessagesFile: "compiler:Languages\Dutch.isl" ; Name: "pt"; MessagesFile: "compiler:Languages\Portuguese.isl" +[Dirs] +Name: "{app}"; +Name: "{app}\p2pool"; Permissions: users-full [Files] ; The use of the flag "ignoreversion" for the following entries leads to the following behaviour: @@ -135,6 +138,7 @@ Type: filesandordirs; Name: "{app}\QtQuick.2" Type: filesandordirs; Name: "{app}\Material" Type: filesandordirs; Name: "{app}\Universal" Type: filesandordirs; Name: "{app}\scenegraph" +Type: filesandordirs; Name: "{app}\p2pool" Type: files; Name: "{app}\D3Dcompiler_47.dll" Type: files; Name: "{app}\libbz2-1.dll" Type: files; Name: "{app}\libEGL.dll" diff --git a/src/p2pool/P2PoolManager.cpp b/src/p2pool/P2PoolManager.cpp index 7f9e2a4f..4d4a2e8f 100644 --- a/src/p2pool/P2PoolManager.cpp +++ b/src/p2pool/P2PoolManager.cpp @@ -50,15 +50,15 @@ void P2PoolManager::download() { QString validHash; #ifdef Q_OS_WIN url = "https://github.com/SChernykh/p2pool/releases/download/v1.9/p2pool-v1.9-windows-x64.zip"; - fileName = "p2pool-v1.9-windows-x64.zip"; + fileName = m_p2poolPath + "/p2pool-v1.9-windows-x64.zip"; validHash = "2587903dc04a4879dca2b6f5c5b584e869928e716274a7660e24b219c9f18839"; #elif defined(Q_OS_LINUX) url = "https://github.com/SChernykh/p2pool/releases/download/v1.9/p2pool-v1.9-linux-x64.tar.gz"; - fileName = "p2pool-v1.9-linux-x64.tar.gz"; + fileName = m_p2poolPath + "/p2pool-v1.9-linux-x64.tar.gz"; validHash = "0cd85d933ac4a76708d326698d9db3155bb29d0be82984c735fabd9e9a351b8e"; #elif defined(Q_OS_MACOS) url = "https://github.com/SChernykh/p2pool/releases/download/v1.9/p2pool-v1.9-macos-x64.tar.gz"; - fileName = "p2pool-v1.9-macos-x64.tar.gz"; + fileName = m_p2poolPath + "/p2pool-v1.9-macos-x64.tar.gz"; validHash = "47fbdd69d719da80597dd5487f109b61e30b540499cced7b93de1ee01344351e"; #endif QFile file(fileName); @@ -96,7 +96,7 @@ void P2PoolManager::download() { file.open(QIODevice::WriteOnly); file.write(data); file.close(); - QProcess::execute("tar", {"-xzf", fileName, "--strip=1", "-C", QApplication::applicationDirPath()}); + QProcess::execute("tar", {"-xzf", fileName, "--strip=1", "-C", m_p2poolPath}); QFile::remove(fileName); if (isInstalled()) { emit p2poolDownloadSuccess(); @@ -119,7 +119,7 @@ bool P2PoolManager::isInstalled() { } void P2PoolManager::getStatus() { - QString statsPath = QApplication::applicationDirPath() + "/stats/local/miner"; + QString statsPath = m_p2poolPath + "/stats/local/miner"; bool status = true; if (!QFileInfo(statsPath).isFile() || !started) { @@ -158,7 +158,7 @@ bool P2PoolManager::start(const QString &flags, const QString &address, const QS if (!arguments.contains("--data-api")) { QDir dir; - QString dirName = QApplication::applicationDirPath() + "/stats/"; + QString dirName = m_p2poolPath + "/stats/"; QDir statsDir(dirName); if (dir.exists(dirName)) { statsDir.removeRecursively(); @@ -170,7 +170,7 @@ bool P2PoolManager::start(const QString &flags, const QString &address, const QS if (!arguments.contains("--start-mining")) { arguments << "--start-mining" << threads; } - + if (chain == "mini") { arguments << "--mini"; } @@ -178,7 +178,7 @@ bool P2PoolManager::start(const QString &flags, const QString &address, const QS if (!arguments.contains("--wallet")) { arguments << "--wallet" << address; } - + qDebug() << "starting p2pool " + m_p2pool; qDebug() << "With command line arguments " << arguments; @@ -189,7 +189,7 @@ bool P2PoolManager::start(const QString &flags, const QString &address, const QS // Set program parameters m_p2poold->setProgram(m_p2pool); m_p2poold->setArguments(arguments); - m_p2poold->setWorkingDirectory(QApplication::applicationDirPath()); + m_p2poold->setWorkingDirectory(m_p2poolPath); // Start p2pool started = m_p2poold->startDetached(); @@ -213,7 +213,7 @@ void P2PoolManager::exit() QProcess::execute("pkill", {"p2pool"}); #endif started = false; - QString dirName = QApplication::applicationDirPath() + "/stats/"; + QString dirName = m_p2poolPath + "/stats/"; QDir dir(dirName); dir.removeRecursively(); } @@ -226,9 +226,14 @@ P2PoolManager::P2PoolManager(QObject *parent) started = false; // Platform dependent path to p2pool #ifdef Q_OS_WIN - m_p2pool = QApplication::applicationDirPath() + "/p2pool.exe"; + m_p2poolPath = QApplication::applicationDirPath() + "/p2pool"; + if (!QDir(m_p2poolPath).exists()) { + QDir().mkdir(m_p2poolPath); + } + m_p2pool = m_p2poolPath + "/p2pool.exe"; #elif defined(Q_OS_UNIX) - m_p2pool = QApplication::applicationDirPath() + "/p2pool"; + m_p2poolPath = QApplication::applicationDirPath(); + m_p2pool = m_p2poolPath + "/p2pool"; #endif if (m_p2pool.length() == 0) { qCritical() << "no p2pool binary defined for current platform"; diff --git a/src/p2pool/P2PoolManager.h b/src/p2pool/P2PoolManager.h index 82e7832d..f1679567 100644 --- a/src/p2pool/P2PoolManager.h +++ b/src/p2pool/P2PoolManager.h @@ -64,6 +64,7 @@ private: std::unique_ptr m_p2poold; QMutex m_p2poolMutex; QString m_p2pool; + QString m_p2poolPath; bool started = false; mutable FutureScheduler m_scheduler;