[kupfer] config: Allow custom package in get_data_file
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer] config: Allow custom package in get_data_file
- Date: Wed, 9 Sep 2009 19:15:39 +0000 (UTC)
commit 6feff29a7e430cedf9d5e97f5898a84613581277
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Wed Sep 9 00:56:21 2009 +0200
config: Allow custom package in get_data_file
With a custom package name, we can use get_data_file to find data
files used by other applications inside XDG_DATA_HOME as well, such as
rhythmbox.
kupfer/config.py | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/kupfer/config.py b/kupfer/config.py
index a72e20b..194556d 100644
--- a/kupfer/config.py
+++ b/kupfer/config.py
@@ -29,7 +29,7 @@ def get_cache_file(path=()):
return None
return cache_dir
-def get_data_file(filename):
+def get_data_file(filename, package=PACKAGE_NAME):
"""
Return path to @filename if it exists
anywhere in the data paths, else return None
@@ -40,10 +40,10 @@ def get_data_file(filename):
except ImportError:
first_datadir = "./data"
else:
- first_datadir = os.path.join(version_subst.DATADIR, PACKAGE_NAME)
+ first_datadir = os.path.join(version_subst.DATADIR, package)
data_paths.append(first_datadir)
- for data_path in base.load_data_paths(PACKAGE_NAME):
+ for data_path in base.load_data_paths(package):
if not data_path in data_paths:
data_paths.append(data_path)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]