← Back to team overview

zim-wiki team mailing list archive

Re: Win32: configuration path

 

Hi Japp,


> This sounds like a reasonable proposal. Indeed setting XDG_DATA to the
> relevant path will change the lookup path for zim. Probably you'll
> also want to do something similar for XDG_CONFIG and XDG_CACHE.
>
> All these parameters are initialized in zim/config.py, feel free to
> patch it accordingly and submit the patch through a bug report.

I did this (diff -b):

========================================
99a100,103
>
> 	if not 'APPDATA' in os.environ or not os.environ['APPDATA']:
> 		os.environ['APPDATA'] = os.environ['HOME']
>
140a145,160
> 	if os.name == 'nt':
> 		XDG_DATA_HOME = Dir(
> 			get_environ('XDG_DATA_HOME', os.environ['APPDATA'] + '//zim//data'))
>
> 		XDG_DATA_DIRS = Dir(
> 			get_environ('XDG_DATA_DIRS', os.environ['APPDATA'] + '//zim//data//zim'))
>
> 		XDG_CONFIG_HOME = Dir(
> 			get_environ('XDG_CONFIG_HOME', os.environ['APPDATA'] + '//zim//config'))
>
> 		XDG_CONFIG_DIRS = Dir(
> 			get_environ('XDG_CONFIG_DIRS', os.environ['APPDATA'] + '//zim//config//zim'))
>
> 		XDG_CACHE_HOME = Dir(
> 			get_environ('XDG_CACHE_HOME', os.environ['APPDATA'] + '//zim//cache'))
> 	else:
========================================

Local settings folders can be retrieved from registry, but that's
probably not so good idea

This proposed folder structure doesn't look very good, as Zim code is
made in respect to XDG suggestions and rest of the code will need
changes to make more proper Windows special folders pairing. But
that's not some big problem, and this way Zim config files will be in
one place where it's expected on Windows - %APPDATA% folder.

I tested these settings, but I'm just not sure about XDG_xxx_DIRS
variables and their role


> P.S. behavior is documented in the manual, so you could have saved a
> bit of trouble by looking there instead of going over the code ;)

Thanks. Good to know that manual includes technical details, which I
didn't expect ;)


Cheers


Follow ups

References