From 828ecb6b3ccb71b85dc3f9260ddbe63b45987174 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Fri, 1 Oct 2010 20:51:08 +0000 Subject: [PATCH] Fix to last commit --- src/misc.cpp | 14 ++++++++++++++ src/misc.h | 3 +++ src/searchengine.cpp | 4 ++++ 3 files changed, 21 insertions(+) diff --git a/src/misc.cpp b/src/misc.cpp index a6fd29749..a00411ae3 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -363,6 +363,20 @@ void misc::copyDir(QString src_path, QString dst_path) { } } +void misc::chmod644(const QDir& folder) { + qDebug("chmod644(%s)", qPrintable(folder.absolutePath())); + if(!folder.exists()) return; + foreach(const QFileInfo &fi, folder.entryInfoList(QDir::Dirs|QDir::Files|QDir::NoSymLinks)) { + if(fi.fileName().startsWith(".")) continue; + if(fi.isDir()) { + misc::chmod644(QDir(fi.absoluteFilePath())); + } else { + QFile f(fi.absoluteFilePath()); + f.setPermissions(f.permissions()|QFile::ReadUser|QFile::WriteUser|QFile::ReadGroup|QFile::ReadOther); + } + } +} + QString misc::updateLabelInSavePath(const QString& defaultSavePath, QString save_path, const QString old_label, const QString new_label) { if(old_label == new_label) return save_path; qDebug("UpdateLabelInSavePath(%s, %s, %s)", qPrintable(save_path), qPrintable(old_label), qPrintable(new_label)); diff --git a/src/misc.h b/src/misc.h index 8b04beb13..db3a440f8 100644 --- a/src/misc.h +++ b/src/misc.h @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -75,6 +76,8 @@ public: return QString(o.str().c_str()); } + static void chmod644(const QDir& folder); + static inline QString removeLastPathPart(QString path) { if(path.isEmpty()) return path; path = path.replace("\\", "/"); diff --git a/src/searchengine.cpp b/src/searchengine.cpp index cc299a1f4..6afd36bed 100644 --- a/src/searchengine.cpp +++ b/src/searchengine.cpp @@ -549,6 +549,10 @@ void SearchEngine::updateNova() { } } } +#ifndef Q_WS_WIN + // Fix permissions + misc::chmod644(QDir(misc::searchEngineLocation())); +#endif } // Slot called when search is Finished