On Mon, Oct 29, 2012 at 8:42 PM, Jaap Karssenberg wrote:
>> So that if user has config files as in zim 0.57 config folders, above
>> snippet will make it compatible to potentially new config folder
>> scheme?
> Yes, that is the idea.

That sounds great :)

>>> Probably the CACHE variable should go to a folder for temporary data.
>>> Not %TMP% because we want it available longer, but it can be flushed
>>> when space is needed on the system.
>> I don't know about existence of other temporary folder except %TMP% and 
>> %TEMP%
> Isn't there a folder that is also used for things like temporary
> internet files ?

Sure, and by just looking in there I see Gimp also uses it for caching (gegl)

With SPL folder can be located by reading the registry (on any Windows version):

>>> import _winreg as wreg
>>> wreg_key = wreg.OpenKey(wreg.HKEY_CURRENT_USER, 
>>> r'Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders')
>>> wreg.QueryValueEx(wreg_key, "Cache")
(u'%USERPROFILE%\\Local Settings\\Temporary Internet Files', 2)


>>> import os
>>> wreg.QueryValueEx(wreg_key, "Cache")[0].replace(u'%USERPROFILE%', 
>>> os.environ['USERPROFILE'])
u'C:\\Documents and Settings\\klo\\Local Settings\\Temporary Internet Files'

So, considering previous talk, something like this should be sensible
for Windows users:

if os.name == 'nt':
        import _winreg as wreg
        XDG_DATA_HOME = Dir(
                get_environ('XDG_DATA_HOME', os.environ['APPDATA'] + 

        XDG_DATA_DIRS = Dir(
                        get_environ('XDG_DATA_HOME', '~/.local/share/'))

        XDG_CONFIG_HOME = Dir(
                get_environ('XDG_CONFIG_HOME', os.environ['APPDATA'] + 

        XDG_CONFIG_DIRS = Dir(
                        get_environ('XDG_CONFIG_HOME', '~/.config/'))

                wreg_key = wreg.OpenKey(wreg.HKEY_CURRENT_USER,
r'Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell
                cache_dir = str(wreg.QueryValueEx(wreg_key,
"Cache")[0].replace(u'%USERPROFILE%', os.environ['USERPROFILE']))
                cache_dir = os.environ['TEMP']

        XDG_CACHE_HOME = Dir(
                get_environ('XDG_CACHE_HOME', cache_dir + '//zim'))

Mailing list: https://launchpad.net/~zim-wiki
Post to     : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp

Reply via email to