[gnote] Create configuration directories as S_IRWXU
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Create configuration directories as S_IRWXU
- Date: Sun, 7 Nov 2010 12:01:25 +0000 (UTC)
commit 24d5f6eec34c55a511d5480a20ec8c95d2757edb
Author: Debarshi Ray <debarshir src gnome org>
Date: Fri Nov 5 00:14:03 2010 +0200
Create configuration directories as S_IRWXU
XDG Base Directory Specification says that directories should be
created S_IRWXU: https://bugzilla.gnome.org/631408#c2
Use g_mkdir_with_parents instead of sharp::directory_create to
ensure that the directories have the specified permissions.
src/addinmanager.cpp | 16 ++++++----------
src/addins/bugzilla/bugzillanoteaddin.cpp | 4 +++-
src/addins/bugzilla/bugzillapreferences.cpp | 4 +++-
3 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/src/addinmanager.cpp b/src/addinmanager.cpp
index 84ec14d..f6b4113 100644
--- a/src/addinmanager.cpp
+++ b/src/addinmanager.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2009 Debarshi Ray
+ * Copyright (C) 2009, 2010 Debarshi Ray
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -24,6 +24,8 @@
#include <boost/bind.hpp>
#include <boost/checked_delete.hpp>
+#include <glib.h>
+
#include "sharp/map.hpp"
#include "sharp/directory.hpp"
#include "sharp/dynamicmodule.hpp"
@@ -87,7 +89,7 @@ namespace gnote {
&& sharp::directory_exists(old_addins_dir);
if (is_first_run)
- sharp::directory_create(m_addins_prefs_dir);
+ g_mkdir_with_parents(m_addins_prefs_dir.c_str(), S_IRWXU);
if (migration_needed)
migrate_addins(old_addins_dir);
@@ -211,15 +213,9 @@ namespace gnote {
void AddinManager::initialize_sharp_addins()
{
+ if (!sharp::directory_exists (m_addins_prefs_dir))
+ g_mkdir_with_parents(m_addins_prefs_dir.c_str(), S_IRWXU);
- try {
- if(!sharp::directory_exists(m_addins_prefs_dir)) {
- sharp::directory_create(m_addins_prefs_dir);
- }
- }
- catch(...) {
-
- }
// get the factory
REGISTER_BUILTIN_NOTE_ADDIN(NoteRenameWatcher);
diff --git a/src/addins/bugzilla/bugzillanoteaddin.cpp b/src/addins/bugzilla/bugzillanoteaddin.cpp
index bf21faf..24d1fca 100644
--- a/src/addins/bugzilla/bugzillanoteaddin.cpp
+++ b/src/addins/bugzilla/bugzillanoteaddin.cpp
@@ -1,6 +1,7 @@
/*
* gnote
*
+ * Copyright (C) 2010 Debarshi Ray
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -23,6 +24,7 @@
#include <pcrecpp.h>
+#include <glib.h>
#include <glibmm/i18n.h>
@@ -89,7 +91,7 @@ namespace bugzilla {
&& sharp::directory_exists(old_images_dir);
if (is_first_run)
- sharp::directory_create(images_dir());
+ g_mkdir_with_parents(images_dir().c_str(), S_IRWXU);
if (migration_needed)
migrate_images(old_images_dir);
diff --git a/src/addins/bugzilla/bugzillapreferences.cpp b/src/addins/bugzilla/bugzillapreferences.cpp
index b41de17..bb2db48 100644
--- a/src/addins/bugzilla/bugzillapreferences.cpp
+++ b/src/addins/bugzilla/bugzillapreferences.cpp
@@ -1,6 +1,7 @@
/*
* gnote
*
+ * Copyright (C) 2010 Debarshi Ray
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -19,6 +20,7 @@
+#include <glib.h>
#include <glibmm/i18n.h>
#include <gtkmm/buttonbox.h>
#include <gtkmm/filechooserdialog.h>
@@ -307,7 +309,7 @@ namespace bugzilla {
std::string saved_path = s_image_dir + "/" + host + ext;
try {
if (!sharp::directory_exists (s_image_dir)) {
- sharp::directory_create (s_image_dir);
+ g_mkdir_with_parents(s_image_dir.c_str(), S_IRWXU);
}
sharp::file_copy (file_path, saved_path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]