From aeb6df05bd98082ac8bc7b533cf9520e9bb738be Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Sat, 17 Dec 2011 07:33:21 +0100 Subject: [PATCH] Fix application config directory for Darwin platforms. --- linkcheck/bookmarks/chrome.py | 9 +++++++-- linkcheck/bookmarks/chromium.py | 8 +++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/linkcheck/bookmarks/chrome.py b/linkcheck/bookmarks/chrome.py index 630dc75f..5a441acb 100644 --- a/linkcheck/bookmarks/chrome.py +++ b/linkcheck/bookmarks/chrome.py @@ -14,8 +14,9 @@ # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -import os +import os +import sys # Windows filename encoding nt_filename_encoding="mbcs" @@ -36,7 +37,11 @@ def get_profile_dir (): dirpath = os.path.join(basedir, u"Google", u"Chrome", u"User Data") elif os.name == 'posix': basedir = unicode(os.environ["HOME"]) - dirpath = os.path.join(basedir, u".config", u"Google", u"Chrome") + if sys.platform == 'darwin': + dirpath = os.path.join(basedir, u"Library", u"Application Support") + else: + dirpath = os.path.join(basedir, u".config") + dirpath = os.path.join(dirpath, u"Google", u"Chrome") return dirpath diff --git a/linkcheck/bookmarks/chromium.py b/linkcheck/bookmarks/chromium.py index 99c59567..dcf329fe 100644 --- a/linkcheck/bookmarks/chromium.py +++ b/linkcheck/bookmarks/chromium.py @@ -14,7 +14,9 @@ # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + import os +import sys import json @@ -37,7 +39,11 @@ def get_profile_dir (): dirpath = os.path.join(basedir, u"Chromium", u"User Data") elif os.name == 'posix': basedir = unicode(os.environ["HOME"]) - dirpath = os.path.join(basedir, u".config", u"chromium") + if sys.platform == 'darwin': + dirpath = os.path.join(basedir, u"Library", u"Application Support") + else: + dirpath = os.path.join(basedir, u".config") + dirpath = os.path.join(dirpath, u"chromium") return dirpath