more safexx posix stuff

This commit is contained in:
Jean-Francois Dockes
2015-08-22 08:37:58 +02:00
parent f095e38633
commit 62f4f7bd81
18 changed files with 50 additions and 18 deletions
+1 -1
View File
@@ -148,7 +148,7 @@ FragButs::FragButs(QWidget* parent)
m_fn = path_cat(theconfig->getConfDir(), "fragbuts.xml");
string data, reason;
if (access(m_fn.c_str(), 0) != 0) {
if (!path_exists(m_fn)) {
// config does not exist: try to create it from sample
string src = path_cat(theconfig->getDatadir(), "examples");
src = path_cat(src, "fragbuts.xml");
+1 -1
View File
@@ -123,7 +123,7 @@ void multiSave(QWidget *p, vector<Rcl::Doc>& docs)
for (unsigned int i = 0; i != docs.size(); i++) {
string fn = path_cat(dir, filenames[i]);
if (access(fn.c_str(), 0) == 0) {
if (path_exists(fn)) {
QMessageBox::warning(0, "Recoll",
QWidget::tr("Unexpected file name collision, "
"cancelling."));
+3
View File
@@ -14,6 +14,9 @@
* Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "autoconfig.h"
#include "safeunistd.h"
#include <list>
#include <utility>
+1 -1
View File
@@ -41,7 +41,7 @@ static QString prevDir()
settings.value("/Recoll/prefs/lastQuerySaveDir").toString();
string defpath = path_cat(theconfig->getConfDir(), "saved_queries");
if (prevdir.isEmpty()) {
if (access(defpath.c_str(), 0) != 0) {
if (!path_exists(defpath)) {
mkdir(defpath.c_str(), 0700);
}
return QString::fromLocal8Bit(defpath.c_str());
+2
View File
@@ -16,6 +16,8 @@
*/
#include "autoconfig.h"
#include "safeunistd.h"
#include <list>
#include <QMessageBox>
+1
View File
@@ -17,6 +17,7 @@
#include "autoconfig.h"
#include <fcntl.h>
#include "safeunistd.h"
#include <utility>
#include MEMORY_INCLUDE
+5 -4
View File
@@ -18,6 +18,7 @@
#include <stdio.h>
#include "safesysstat.h"
#include "safeunistd.h"
#include <string>
@@ -60,7 +61,7 @@ void RTIToolW::init()
connect(this->sesCB, SIGNAL(clicked(bool)),
this, SLOT(sesclicked(bool)));
string autostartfile = path_cat(path_home(), rautostartfile);
if (access(autostartfile.c_str(), 0) == 0) {
if (path_exists(autostartfile)) {
sesCB->setChecked(true);
}
}
@@ -80,7 +81,7 @@ void RTIToolW::accept()
if (sesCB->isChecked()) {
// Setting up daemon indexing autostart
if (::access(autostartfile.c_str(), 0) == 0) {
if (path_exists(autostartfile)) {
QString msg = tr("Replacing: ") +
QString::fromLocal8Bit(autostartfile.c_str());
@@ -96,7 +97,7 @@ void RTIToolW::accept()
if (theconfig) {
string sourcefile = path_cat(theconfig->getDatadir(), "examples");
sourcefile = path_cat(sourcefile, "recollindex.desktop");
if (::access(sourcefile.c_str(), 0) == 0) {
if (path_exists(sourcefile)) {
file_to_string(sourcefile, text);
}
}
@@ -138,7 +139,7 @@ void RTIToolW::accept()
exitdial = true;
} else {
// Turning autostart off
if (::access(autostartfile.c_str(), 0) == 0) {
if (path_exists(autostartfile)) {
QString msg = tr("Deleting: ") +
QString::fromLocal8Bit(autostartfile.c_str());
+1 -1
View File
@@ -565,7 +565,7 @@ void UIPrefsDialog::addExtraDbPB_clicked()
if (input.isEmpty())
return;
string dbdir = (const char *)input.toLocal8Bit();
if (access(path_cat(dbdir, "recoll.conf").c_str(), 0) == 0) {
if (path_exists(path_cat(dbdir, "recoll.conf"))) {
// Chosen dir is config dir.
RclConfig conf(&dbdir);
dbdir = conf.getDbDir();