default folders hardcoded

Bug #226269 reported by umaxx
2
Affects Status Importance Assigned to Milestone
Griffith
Confirmed
Low
Unassigned

Bug Description

hardcoding fonts folder in file "griffith" is a bad idea:

 self.widgets['preferences']['font'].set_current_folder("/usr/share/fonts/")

which results in error messages on startup on BSD-Systems

better do something like this:

 self.widgets['preferences']['font'].set_current_folder(os.path.join(sys.prefix, "share", "fonts"))

sys.prefix -> /usr or /usr/local depending on the distribution/unix/linux...

os.path for joining path is platform independent way (works on old mac ostoo for example with : as path-seperateor instead of slash or backslash)

Furthermore font path heavily depends on unix-flavor, for example: openbsd uses: /usr/local/lib/X11/fonts

umaxx (umaxx)
description: updated
Revision history for this message
Michael (mikej06) wrote :

Full acknowledge with os.path, of course. With the bad idea of hardcoding paths too.

But the documentation of python says that sys.prefix is not necessarily the "system path". An extract from the documentation:
sys.prefix
A string giving the site-specific directory prefix where the platform independent Python files are installed; by default, this is the string '/usr/local'. This can be set at build time with the --prefix argument to the configure script. The main collection of Python library modules is installed in the directory prefix + '/lib/pythonversion' while the platform independent header files (all except pyconfig.h) are stored in prefix + '/include/pythonversion', where version is equal to version[:3].

Some linux distributions install software like python at "/opt/..." and fonts at "/usr/...".
I think there should be a better solution as hardcoding paths and the use of sys.prefix.

Suggestions are welcome.

Changed in griffith:
importance: Undecided → Low
status: New → Confirmed
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.