From fef762bf35f55200e89660dd6303f6c5adbef66c Mon Sep 17 00:00:00 2001 From: Gemba Date: Tue, 24 Dec 2024 15:44:45 +0100 Subject: [PATCH] added detection of duplicate installs --- src/config.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/config.cpp b/src/config.cpp index 109119f0..813fb7f7 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -154,14 +154,26 @@ void Config::setupUserConfig() { // Config::getSkyFolder(type ...) QDir::setCurrent(getSkyFolder()); - // copy configs - QString localEtcPath = QString(PREFIX "/etc/skyscraper/"); + QString rpInst = "/opt/retropie/supplementary/skyscraper/Skyscraper"; + bool isRpInstall = QFileInfo(rpInst).isFile(); + QString manualInst = PREFIX "/Skyscraper"; + bool exeIsSymlink = QFileInfo(manualInst).isSymLink(); - if (!QFileInfo::exists(localEtcPath)) { + if (!exeIsSymlink && isRpInstall) { + printf("\033[1;31mDuplicate installation of Skyscraper found:\n%s " + "and\n%s\nPlease remove one or the other to avoid " + "confusion.\033[0m\n", + manualInst.toStdString().c_str(), rpInst.toStdString().c_str()); + exit(1); + } + + QString localEtcPath = QString(PREFIX "/etc/skyscraper/"); + if (!QFileInfo::exists(localEtcPath) || isRpInstall) { // RetroPie or Windows installation type: handled externally return; } + // copy configs QMap> configFiles = { {"ARTWORK.md", QPair("", FileOp::OVERWRITE)}, {"artwork.xml.example1", QPair("", FileOp::OVERWRITE)},