[gnome-tweak-tool] gtksettings: Create config directories as necessary
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tweak-tool] gtksettings: Create config directories as necessary
- Date: Thu, 1 Jun 2017 10:19:38 +0000 (UTC)
commit 7bdcf1298ca9ef3bdddae77bc84e875293192708
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Jun 1 00:24:57 2017 +0200
gtksettings: Create config directories as necessary
Writing the .ini file currently fails if its config directory didn't
exist previously. At least for the gtk-4.0 case that's not entirely
unlikely, so try to create it if necessary.
https://bugzilla.gnome.org/show_bug.cgi?id=783304
gtweak/gtksettings.py | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/gtweak/gtksettings.py b/gtweak/gtksettings.py
index 8d10f2e..b869233 100644
--- a/gtweak/gtksettings.py
+++ b/gtweak/gtksettings.py
@@ -16,6 +16,7 @@
# along with gnome-tweak-tool. If not, see <http://www.gnu.org/licenses/>.
import os.path
+import errno
import logging
from gi.repository import GLib
@@ -55,6 +56,14 @@ class GtkSettingsManager:
keyfile.set_integer(SETTINGS_GROUP_NAME, key, value)
try:
+ os.makedirs(os.path.dirname(self._path))
+ except OSError, e:
+ if e.errno is not errno.EEXIST:
+ raise
+ except:
+ raise
+
+ try:
data = keyfile.to_data()
GLib.file_set_contents(self._path, data[0])
except:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]