Closed GoogleCodeExporter closed 8 years ago
I think something to remember is that traditionally applications under Linux
place
their configuration data in ether $HOME/.apprc or in the directory $HOME/.app/
Look at Firefox (in ~/.mozilla/firefox/ or ~/.mozilla/firefox-3.5) for example.
It will take time for all applications to migrate to the FreeDesktop specs.
Tim
Original comment by weir...@gmail.com
on 24 Jul 2009 at 3:50
yes, that was BEFORE basedir-spec
As far as know, all GNOME applications ARE changing location of their datas to
match
the spec (i'm not a KDE user but KDE is also supposed to follow FreeDesktop
specs)
There even is a tracking bug http://bugzilla.gnome.org/show_bug.cgi?id=523057
On Ubuntu, if you look at the $HOME/.config, you will see that things are
changing
Original comment by thibaut....@gmail.com
on 24 Jul 2009 at 4:19
Code in jbrout.py shows that it has been taken in account.
Unfortunately it first tries with ~ and (with my computer) it works, so it
stops with that.
Lines 100-106 need to moved more at the bottom of the block, so
$XDG_CONFIG_HOME, and $HOME/.config will be tried first.
http://code.google.com/p/jbrout/source/browse/trunk/jbrout/jbrout/conf.py#87
Original comment by p...@gmx.fr
on 26 Oct 2010 at 10:39
Also, this is an extraordinarily ugly code IMHO ... exception should be used
for exceptions not as a replacement of if ... else construct.
Original comment by matej.c...@gmail.com
on 26 Oct 2010 at 11:35
Suggested solution for this bug (see
http://gitorious.org/jbrout/jbrout/commits/issue56 for the VCS location of this
patch).
Original comment by matej.c...@gmail.com
on 26 Oct 2010 at 11:58
Attachments:
os.path.expanduser("~") seems to work on both windows and linux, it's why it's
useful.
Can you try to add the .config folder at this time?
(For example i don't have $XDG_CONFIG_HOME, but i have still some app using
.config)
So, adding between your lines 45-46
conf = os.path.join(home,".config")
if os.path.isdir(conf):
home = conf
Or maybe trying $HOME between expanduser("~")
Original comment by p...@gmx.fr
on 27 Oct 2010 at 9:00
Right, I have no $XDG_CONFIG_HOME either. Let me dig into spec again.
Original comment by matej.c...@gmail.com
on 27 Oct 2010 at 12:10
Moreover, it is not just about ~/.config, but also ~/.cache (where IMHO db.xml
should go) and ~/.local/share/ (where configuration should go). See
http://live.gnome.org/GnomeGoals/XDGConfigFolders for more information.
Original comment by matej.c...@gmail.com
on 27 Oct 2010 at 12:43
This http://standards.freedesktop.org/basedir-spec/latest/ar01s03.html seems
like very relevant.
Original comment by matej.c...@gmail.com
on 27 Oct 2010 at 12:44
Hmm, how is XDG spec supposed to work on MS Windows? Should I create non-hidden
dot.folders (~/.config, ~/.cache, ~/.local/share) or non-dotted hidden ones?
Original comment by matej.c...@gmail.com
on 27 Oct 2010 at 12:50
On Windows, it would depend on the version (98-Me/NT/XP/Vista/Seven). First
does someone know which versions of Windows jBrout works on? We should avoid
handling 95/98/Me if jBrout stars working on XP!
What are the Linux directories for? I expected ~/.config to contain
configuration, but ceplm said it should go into ~/.local/share/ , why?
I suppose ~/.cache is for temporary files, anything which can safely be erased
when closing a session, there would be only a time penalty for rebuilding
whatever was destroyed. If so, db.xml could indeed go there, but not tags.xml.
Original comment by davito...@gmail.com
on 27 Oct 2010 at 1:35
http://ploum.net/post/184-cleaning-user-preferences-keeping-user-data
> The concept is fairly easy : if you can't afford to loose it, it's an user
data. If a usable default exist, it's a preference. If I restore or reinstall
my desktop, I don't mind if I must re-set my wallpaper, re-choose my favourite
gnome applets,re-set the nautilus spatial mode and home-is-desktop options. But
I highly care to get my files back, my songs statistics and playlists in
Rhythmbox, my emails/contacts/calendars in evolution, my tomboy notes, my
bookmarks, my highscores, my rss feeds and my IM contacts. Those are data !
Yes, just like my plain old files. But knowing that I have french spell
checking enabled in Gedit and last.fm plugin enabled in Rhythmbox is not.
So yes, looking at my current ~/.jbrout I can see
jakoubek:~ $ ls .jbrout/
db.xml jbrout.conf tags.xml
jakoubek:~ $
The first one should IMHO go to ~/.cache/jbrout, second to ~/.config/jbrout,
and the third one (and any other data we may produce in the future) to
~/.local/share/jbrout
Original comment by matej.c...@gmail.com
on 27 Oct 2010 at 2:11
On the other hand, if we accept this spec we could have much less problems ...
just create particular folders if they are not there in ~/ (modulo Windows ...
I am really not sure which folders are supposed to be created there) and you're
done.
Original comment by matej.c...@gmail.com
on 27 Oct 2010 at 2:12
I believe I understand:
.cache = rebuildable data
.config = configuration
.local = actual user data
Then in Windows Vista, from what I can see on my system:
.cache = %TEMP% (which translates to c:\users\[user name]\AppData\Local\Temp)
.config = %LOCALAPPDATA% (which translates to c:\users\[user
name]\AppData\Local)
.local = %APPDATA% (which translates to c:\users\[user name]\AppData\Roaming)
XP did not have %LOCALAPP_DATA%, so for XP, .config and .local directories
would both map to the same %APPDATA%:
.cache = %TEMP% (which translates to c:\users\[user name]\AppData\Local\Temp)
.config = %APPDATA% (which translates to c:\Documents and Settings\[user
name]\Application Data)
.local = %APPDATA% (which translates to c:\Documents and Settings\[user
name]\Application Data)
In XP, there is a "c:\Documents and Settings\[user name]\Local
Settings\Application Data", but I don't know why one should use it rather than
%APPDATA%, and no environment variable leads directly to this directory.
There is one issue, though: all these folders are non-browsable, the average
user is not supposed to know these folders even exist. While this is perfectly
OK for db.xml, I believe tags.xml should be visible, in order to be backupable.
In order to allow backuping tags.xml, it must be put either outside the user
directories (probably not a good idea), or in the user documents folder, which
can be accessed through %USERPROFILE%\[localized documents folder name] The
problem here is that this [localized documents folder name] is... localized
("My Documents" in US, "Mes Documents" in France...) but no environment
variable gives the localized name for the current user :-( This page
http://ginstrom.com/scribbles/2008/09/26/retrieving-common-windows-folder-names-
with-python/ seems to show how to retrieve it with Python.
Original comment by davito...@gmail.com
on 27 Oct 2010 at 3:55
Ha, so I've made some interrogations among my Gnome colleagues, and I found
this:
> everybody does stuff differently on Windows and Mac
> you can take a look at Tomboy, Banshee, and MonoDevelop for a few different
examples
> http://live.gnome.org/Tomboy/Directories
but then I've also got a reference to the official Glib functions
g_get_user_*_dir().
See
http://library.gnome.org/devel/glib/stable/glib-Miscellaneous-Utility-Functions.
html for documentation and http://git.gnome.org/browse/glib/tree/glib/gutils.c
for implementation.
Now the question, are they provided by PyGtk? Couldn't we just use them?
Investigation continues.
Original comment by matej.c...@gmail.com
on 27 Oct 2010 at 8:58
Hmm, we have
glib.get_user_cache_dir()
glib.get_user_config_dir()
glib.get_user_data_dir()
glib.get_user_special_dir(directory)
in PyGObject.
Could somebody run this script on Windows? I wonder what it gives:
import glib
print glib.get_user_config_dir()
Original comment by matej.c...@gmail.com
on 27 Oct 2010 at 9:05
There's one thing I hate in Python: it's library system :-( Although, "system"
may be too intelligent for what is actually going on. I tried to test your
instructions, but I couldn't make it work because I couldn't install glib
properly. Tomorrow, I'm going to download and install Pythonxy. I hope it will
enable me to answer your question.
Original comment by davito...@gmail.com
on 27 Oct 2010 at 10:31
shouldn't you have PyGtk (and thus python-gobject) installed already for
jbrout? Given jbrout's dependence on PyGtk (and PyGObject) would make me
believing that using these function would be a good idea.
Original comment by matej.c...@gmail.com
on 27 Oct 2010 at 11:16
I should, but it still fails on "import glib"
Original comment by davito...@gmail.com
on 28 Oct 2010 at 9:57
According to forums, this is a recurring problem, a problem with default paths.
I tried to install PortablePython as well as Python(xy), but they did not solve
my problem since neither seem to have glib pre-installed. So I'll have to
install the necessary libraries 1 by 1, which is going to take time. Maybe on
sunday.
I have 2 versions of python, the one which is installed with jBrout and one I
installed separately. In the jBrout version, help("modules") does not show glib
nor python-gobject, only pygtk (plus close to 400 other modules)
Original comment by davito...@gmail.com
on 29 Oct 2010 at 9:04
OK, giving up ... mysteries of the Windows world never stop to amaze me. Given
that we are importing gobejct many times in jbrout:
jakoubek:jbrout (issue56) $ grep -r 'import gobject' .
./jbrout/jbrout/db.py:import gobject
./jbrout/jbrout/folderselect.py:import gobject
./jbrout/jbrout/listview.py:import gobject
./jbrout/libs/gladeapp.py:import gobject
./jbrout/plugins/bulkTag/bulkTag.py:import gobject
./jbrout/plugins/download/nameBuilder.py:import gobject
./jbrout/plugins/download/download.py:import gobject
./jbrout/jbrout.py:import gobject
jakoubek:jbrout (issue56) $
I would tend to believe it is possible to import it directly somehow. But
apparently I am too dumb for Windows.
Original comment by matej.c...@gmail.com
on 29 Oct 2010 at 9:09
Currently, I am much more perplexed by Python terminology than by Windows
strange behaviors :-)
The following tests were done in jBrout's Python installation.
1 - when I try "import glib", I get "ImportError: No module named glib", which
is consistent with the fact help("modules") did not list it.
2 - when I try "import gobject", I get an "ImportError: DLL load failed" on
"from gobject" or "from _gobject" (I don't know enough python yet to determine
which line is most relevant)
I tried finding another glib function in the jBrout source code, but could not
find any.
Original comment by davito...@gmail.com
on 29 Oct 2010 at 9:46
I have taken over for a moment a Windows computer of my mom and when I have
installed python 2.7.1 (.msi from python.org) and PyGtk
(http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.22/) then I was able to
run "PyGtk prompt" where both python.exe and import glib was possible. The
result seems to make at least sense:
C:\Windows\system32>python
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import glib
>>> print glib.get_user_config_dir()
C:\Users\zuzana\AppData\Roaming
>>> print glib.get_user_cache_dir()
C:\Users\zuzana\AppData\Local\Microsoft\Windows\Temporary Internet Files
>>> print glib.get_user_data_dir()
C:\Users\zuzana\Documents
>>>
So, I strongly suggest to remove all this logic from jbrout itself and just
rely on glib to do The Right Thing.
Original comment by matej.c...@gmail.com
on 8 Jan 2011 at 9:38
So, what do you think about this as a solution?
Original comment by matej.c...@gmail.com
on 4 Jul 2011 at 10:01
Attachments:
great !
Original comment by manat...@gmail.com
on 5 Jul 2011 at 8:34
This issue was closed by revision r334.
Original comment by r...@wallace.gen.nz
on 5 Jul 2011 at 11:34
Damn ! this breaks my old install on ubuntu 9.10 (python-gobject 2.16.1 and
apparently, 2.18 is needed, according to
http://developer.gnome.org/pygobject/stable/glib-functions.html)
I guess I'll have to hold back conf.py on an older revision...
Original comment by chartier...@gmail.com
on 13 Jul 2011 at 1:36
To the comment 27: maintainer of jbrout for Ubuntu 9.10 (is it still
supported?) has always chance to back out this patch.
Original comment by matej.c...@gmail.com
on 6 Dec 2011 at 7:09
Original issue reported on code.google.com by
thibaut....@gmail.com
on 31 Jan 2009 at 6:24