diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2019-01-04 16:13:19 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2019-01-04 16:13:19 +0000 |
| commit | 5ab256d56a484d4b67e961ed21da93091e620d9a (patch) | |
| tree | 3e41cc6eccde892f4680b5bf87a501b9072fa0fa /src/app | |
| parent | d3e68ec37e6f493f9f6069504149983337a438a2 (diff) | |
| download | qmmp-5ab256d56a484d4b67e961ed21da93091e620d9a.tar.gz qmmp-5ab256d56a484d4b67e961ed21da93091e620d9a.tar.bz2 qmmp-5ab256d56a484d4b67e961ed21da93091e620d9a.zip | |
feature to create initial configuration
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@8583 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/app')
| -rw-r--r-- | src/app/qmmpstarter.cpp | 15 | ||||
| -rw-r--r-- | src/app/qmmpstarter.h | 3 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/app/qmmpstarter.cpp b/src/app/qmmpstarter.cpp index cf537b8de..e78796783 100644 --- a/src/app/qmmpstarter.cpp +++ b/src/app/qmmpstarter.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2006-2018 by Ilya Kotov * + * Copyright (C) 2006-2019 by Ilya Kotov * * forkotov02@ya.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -68,6 +68,7 @@ QMMPStarter::QMMPStarter() : QObject() #ifdef Q_OS_WIN m_named_mutex = nullptr; #endif + createInitialConfig(); m_option_manager = new BuiltinCommandLineOption(this); QStringList tmp = qApp->arguments().mid(1); @@ -284,6 +285,18 @@ void QMMPStarter::startPlayer() } } +void QMMPStarter::createInitialConfig() +{ + QString defaultConfig = Qmmp::dataPath() + "/qmmprc.default"; + + if(!QFile::exists(Qmmp::configFile()) && QFile::exists(defaultConfig)) + { + qDebug("QMMPStarter: creating initial config"); + QDir("/").mkpath(Qmmp::configDir()); + QFile::copy(defaultConfig, Qmmp::configFile()); + } +} + void QMMPStarter::savePosition() { QSettings settings(Qmmp::configFile(), QSettings::IniFormat); diff --git a/src/app/qmmpstarter.h b/src/app/qmmpstarter.h index f62fa5b86..0db724d97 100644 --- a/src/app/qmmpstarter.h +++ b/src/app/qmmpstarter.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2006-2017 by Ilya Kotov * + * Copyright (C) 2006-2019 by Ilya Kotov * * forkotov02@ya.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -73,6 +73,7 @@ private: void printVersion(); void printUserInterfaces(); void startPlayer(); + void createInitialConfig(); private: MediaPlayer *m_player; |
