All platform: at startup, ensure that a proper directory for sounds is set

This commit is contained in:
Fabio Bas 2015-05-14 15:47:57 +02:00
parent 924337ee93
commit 8fba04397b

View file

@ -165,6 +165,20 @@ int main(int argc, char *argv[])
if (!QDir().mkpath(settingsCache->getPicsPath() + "/CUSTOM"))
qDebug() << "Could not create " + settingsCache->getPicsPath().toUtf8() + "/CUSTOM. Will fall back on default card images.";
if(settingsCache->getSoundPath().isEmpty() || !QDir(settingsCache->getSoundPath()).exists())
{
QDir tmpDir;
#ifdef Q_OS_MAC
tmpDir = app.applicationDirPath() + "/../Resources/sounds";
#elif defined(Q_OS_WIN)
tmpDir = app.applicationDirPath() + "/sounds";
#else // linux
tmpDir = app.applicationDirPath() + "/../share/cockatrice/sounds/";
#endif
settingsCache->setSoundPath(tmpDir.canonicalPath());
}
if (!settingsValid() || db->getLoadStatus() != Ok) {
qDebug("main(): invalid settings or load status");
DlgSettings dlgSettings;