summaryrefslogtreecommitdiffhomepage
path: root/facetracknoir
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2013-09-17 19:04:54 +0200
committerStanislaw Halik <sthalik@misaki.pl>2013-09-17 19:05:08 +0200
commit088a7524206f40b8385b7da8f0377b72942f0dbd (patch)
tree22a29e8f14e18be77558a624ff29c241b3324ed7 /facetracknoir
parent7307bae90d560eca572e9f063981c97aa70e5968 (diff)
Check .ini access rights on Linux
Diffstat (limited to 'facetracknoir')
-rw-r--r--facetracknoir/facetracknoir.cpp15
-rw-r--r--facetracknoir/facetracknoir.h1
2 files changed, 15 insertions, 1 deletions
diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp
index dc3bd15b..fa1b7ea6 100644
--- a/facetracknoir/facetracknoir.cpp
+++ b/facetracknoir/facetracknoir.cpp
@@ -48,6 +48,10 @@
# define LIB_PREFIX "lib"
#endif
+#if defined(__unix) || defined(__linux)
+# include <unistd.h>
+#endif
+
static bool get_metadata(DynamicLibrary* lib, QString& longName, QIcon& icon)
{
Metadata* meta;
@@ -288,7 +292,6 @@ void FaceTrackNoIR::open() {
// Save the current Settings to the currently 'active' INI-file.
//
void FaceTrackNoIR::save() {
-
QSettings settings("opentrack"); // Registry settings (in HK_USER)
QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString();
@@ -330,6 +333,16 @@ void FaceTrackNoIR::save() {
iniFile.setValue ( "DLL", filter == NULL ? "" : filter->filename);
}
iniFile.endGroup ();
+
+#if defined(__unix) || defined(__linux)
+ QByteArray bytes = currentFile.toUtf8();
+ const char* filename_as_asciiz = bytes.constData();
+
+ if (access(filename_as_asciiz, R_OK | W_OK))
+ {
+ QMessageBox::warning(this, "Something went wrong", "Check permissions and ownership for your .ini file!", QMessageBox::Ok, QMessageBox::NoButton);
+ }
+#endif
}
//
diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h
index 16f42727..b7c164ff 100644
--- a/facetracknoir/facetracknoir.h
+++ b/facetracknoir/facetracknoir.h
@@ -37,6 +37,7 @@
#include <QKeySequence>
#include <QtGui>
#include <QString>
+#include <QByteArray>
#if !defined(_WIN32)
# include <qxtglobalshortcut.h>
#else