Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'mer1618' into 'master'
Create settings path if it doesn't exist.



See merge request !15
  • Loading branch information
Matti Kosola committed Jul 7, 2016
2 parents f18fd22 + f462fa2 commit 76fa166
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
18 changes: 14 additions & 4 deletions main.cpp
Expand Up @@ -22,6 +22,8 @@
#include <QtGui>
#include <QtQml>
#include <QQuickView>
#include <QDir>
#include <QString>

extern "C" {
#include <pty.h>
Expand All @@ -38,11 +40,19 @@ extern "C" {
#include "version.h"
#include "keyloader.h"

void copyFileFromResources(QString from, QString to);
static void copyFileFromResources(QString from, QString to);

int main(int argc, char *argv[])
{
QSettings *settings = new QSettings(QDir::homePath()+"/.config/FingerTerm/settings.ini", QSettings::IniFormat);
QString settings_path(QDir::homePath() + "/.config/FingerTerm");
QDir dir;

if (!dir.exists(settings_path)) {
if (!dir.mkdir(settings_path))
qWarning() << "Could not create fingerterm settings path" << settings_path;
}

QSettings *settings = new QSettings(settings_path + "/settings.ini", QSettings::IniFormat);

QCoreApplication::setApplicationName("Fingerterm");

Expand Down Expand Up @@ -174,7 +184,7 @@ int main(int argc, char *argv[])
return app.exec();
}

void copyFileFromResources(QString from, QString to)
static void copyFileFromResources(QString from, QString to)
{
// copy a file from resources to the config dir if it does not exist there
QFileInfo toFile(to);
Expand All @@ -185,7 +195,7 @@ void copyFileFromResources(QString from, QString to)
newToFile.write( reinterpret_cast<const char*>(res.data()) );
newToFile.close();
} else {
qFatal("failed to copy default config from resources");
qWarning() << "Failed to copy default config from resources to" << toFile.filePath();
}
}
}
2 changes: 1 addition & 1 deletion version.h
@@ -1,5 +1,5 @@
#ifndef VERSION_H
#define VERSION_H
const QString PROGRAM_VERSION="1.3.0";
const QString PROGRAM_VERSION="1.3.2";
#endif

0 comments on commit 76fa166

Please sign in to comment.