Created
March 30, 2013 16:04
-
-
Save aroig/5277233 to your computer and use it in GitHub Desktop.
follow symlinked bookmarks file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 08bd7afa499f91c51b1fd7b58a923e1f95645843 Mon Sep 17 00:00:00 2001 | |
From: Abdo Roig-Maranges <abdo.roig@gmail.com> | |
Date: Sat, 30 Mar 2013 16:58:29 +0100 | |
Subject: [PATCH] follow a symlinked bookmarks file | |
--- | |
ranger/container/bookmarks.py | 5 +++-- | |
1 file changed, 3 insertions(+), 2 deletions(-) | |
diff --git a/ranger/container/bookmarks.py b/ranger/container/bookmarks.py | |
index 8fcda0b..6de0c8b 100644 | |
--- a/ranger/container/bookmarks.py | |
+++ b/ranger/container/bookmarks.py | |
@@ -145,7 +145,8 @@ class Bookmarks(object): | |
self.update() | |
if self.path is None: | |
return | |
- if os.access(self.path, os.W_OK): | |
+ path = os.path.realpath(self.path) | |
+ if os.access(path, os.W_OK): | |
f = open(self.path+".new", 'w') | |
for key, value in self.dct.items(): | |
if type(key) == str\ | |
@@ -156,7 +157,7 @@ class Bookmarks(object): | |
pass | |
f.close() | |
- os.rename(self.path+".new", self.path) | |
+ os.rename(self.path+".new", path) | |
self._update_mtime() | |
def _load_dict(self): | |
-- | |
1.8.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment