Phatch doesn't match FreeDesktop folder specs

Bug #382763 reported by Stani
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Phatch
Fix Released
High
Stani

Bug Description

Phatch places its configuration files in
/home/.phatch directory which doesn't match FreeDesktop directories specs :

The default for $XDG_CONFIG_HOME is $HOME/.config, the default for
$XDG_DATA_HOME is $HOME/.local/share. So all applications should look for
those environment variables and use those default values if the variables
are not set.

This is quite important since it's not possible to easily backup config
& data files if these files are not stored at the right place

See http://www.freedesktop.org/wiki/Specifications/basedir-spec
See also
http://ploum.frimouvy.org/?184-cleaning-user-preferences-keeping-user-data
(main post and comment#8)

Revision history for this message
Stani (stani) wrote :

This should be fixed before we launch the Phatch PPA.

Changed in phatch:
assignee: nobody → stani (stani)
importance: Undecided → High
status: New → Confirmed
Stani (stani)
Changed in phatch:
status: Confirmed → In Progress
Revision history for this message
Stani (stani) wrote :
Download full text (12.1 KiB)

$ bzr diff
=== modified file 'phatch/core/api.py'
--- phatch/core/api.py 2009-05-22 02:52:50 +0000
+++ phatch/core/api.py 2009-06-03 02:46:55 +0000
@@ -28,6 +28,7 @@
 from message import send
 from settings import create_settings
 from unicoding import ensure_unicode, exception_to_unicode, ENCODING
+from formField import ensure_path

 #---classes

@@ -68,18 +69,19 @@

 #---init/exit
 def init():
- verify_app_user_path()
+ verify_app_user_paths()
     import_actions()

 def exit():
     pass

-def verify_app_user_path():
- for path in [ct.APP_USER_PATH,ct.APP_USER_PATH,ct.USER_ACTIONLISTS_PATH,
- ct.USER_ACTIONS_PATH,ct.USER_MASKS_PATH,ct.USER_WATERMARKS_PATH]:
- if not os.path.exists(path):
- os.mkdir(path)
+def verify_app_user_paths():
+ for path in [ct.USER_DATA_PATH, ct.USER_CONFIG_PATH,
+ ct.USER_CACHE_PATH, ct.USER_ACTIONLISTS_PATH,
+ ct.USER_ACTIONS_PATH, ct.USER_BIN_PATH, ct.USER_MASKS_PATH,
+ ct.USER_HIGHLIGHTS_PATH, ct.USER_WATERMARKS_PATH]:
+ ensure_path(path)

 #---various
 def title(f):
@@ -89,7 +91,7 @@
 def init_error_log_file():
     global ERROR_LOG_FILE, ERROR_LOG_COUNTER
     ERROR_LOG_COUNTER = 0
- ERROR_LOG_FILE = codecs.open(ct.ERROR_LOG_PATH, 'wb',
+ ERROR_LOG_FILE = codecs.open(ct.USER_LOG_PATH, 'wb',
                             encoding=ENCODING,errors='replace')

 def log_error(message,filename,action=None,label='Error'):
@@ -407,12 +409,9 @@
     modules = \
         [import_module(os.path.basename(os.path.splitext(filename)[0]),
             'actions')
- for filename in glob.glob(os.path.join(ct.ACTIONS_PATH,'*.py'))]+\
+ for filename in glob.glob(os.path.join(ct.PHATCH_ACTIONS_PATH,'*.py'))]+\
         [import_module(os.path.basename(os.path.splitext(filename)[0])) for
             filename in glob.glob(os.path.join(ct.USER_ACTIONS_PATH,'*.py'))]
-## for filename in glob.glob(os.path.join(ct.ACTIONS_PATH,'*.py')):
-## basename= os.path.basename(os.path.splitext(filename)[0])
-## module = import_module(basename,'actions')
     ACTIONS = {}
     for module in modules:
         try:
@@ -420,14 +419,14 @@
         except AttributeError:
             continue
         #register action
- ACTIONS[cl.label] = cl
+ ACTIONS[cl.label] = cl
     #ACTION_LABELS
- ACTION_LABELS = ACTIONS.keys()
+ ACTION_LABELS = ACTIONS.keys()
     ACTION_LABELS.sort()
     #ACTION_FIELDS
- ACTION_FIELDS = {}
+ ACTION_FIELDS = {}
     for label in ACTIONS:
- ACTION_FIELDS[label] = ACTIONS[label]()._fields
+ ACTION_FIELDS[label] = ACTIONS[label]()._fields

 def save_actionlist(filename,data):
     """data = {'actions':...}"""

=== modified file 'phatch/core/config.py'
--- phatch/core/config.py 2009-05-28 12:36:21 +0000
+++ phatch/core/config.py 2009-06-03 02:47:07 +0000
@@ -24,13 +24,31 @@
     USER_PATH = USER_PATH.decode(sys.getfilesystemencoding())
 except:
     pass
-APP_USER_PATH ...

Changed in phatch:
status: In Progress → Fix Committed
Stani (stani)
Changed in phatch:
milestone: none → 0.2.1
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.