From fef005d0422031b35578182ada78a8939dfe6620 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sun, 22 Jun 2014 23:29:42 +0200 Subject: [PATCH] OSX: Handle sounds for first time installations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the sounds path is unset in the settings and a “sounds” directory doesn’t exists in the user’s data directory, install the sounds files and set the settings value accordingly --- cockatrice/src/main.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cockatrice/src/main.cpp b/cockatrice/src/main.cpp index f3e2ad16..bce3075c 100644 --- a/cockatrice/src/main.cpp +++ b/cockatrice/src/main.cpp @@ -146,6 +146,20 @@ int main(int argc, char *argv[]) settingsCache->setPlayerBgPath(destDir + "/fabric_gray.png"); } } + + if(settingsCache->getSoundPath().isEmpty()) + { + QString srcDir = QLibraryInfo::location(QLibraryInfo::DataPath); + QString destDir = dataDir + "/sounds"; + QDir tmpDir(destDir); + if(!tmpDir.exists()) + { + // try to install the default sounds for the current user and set the settigs value + settingsCache->copyPath(srcDir + "/sounds", destDir); + + settingsCache->setSoundPath(destDir); + } + } #endif if (!db->getLoadSuccess() || !QDir(settingsCache->getDeckPath()).exists() || settingsCache->getDeckPath().isEmpty() || settingsCache->getPicsPath().isEmpty() || !QDir(settingsCache->getPicsPath()).exists()) {