bad paths for config and hiscores in windows

Bug #844884 reported by ccanepa
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
enjuewemela
New
Undecided
Unassigned

Bug Description

Bad paths for config and hiscores in windows

*** Demoing the config path problem:
choose options
start game
modify any seting, by example 'sound volume'
You see a traceback similar to
 ...
   File "C:\Python26\share\enjuewemela\enjuewemela\games.py", line 65, in __setit
 em__
  self.parser.save(self.fname)
   File "C:\Python26\lib\site-packages\configglue\parser.py", line 557, in save
  fp = open(fp, 'w')
 IOError: [Errno 2] No such file or directory: '/.config\\enjuewemela.conf'

*** Demoing the highscores path problem:
start game
choose new game , rush
play a game.
At gameover you get a traceback similar to
    File "C:\Python26\share\enjuewemela\enjuewemela\games.py", line 602, in game_over
  self.game_stats.save_score()
   File "C:\Python26\share\enjuewemela\enjuewemela\stats.py", line 337, in save_score
  with open(fname, 'wb') as fh:
 IOError: [Errno 2] No such file or directory: '/.local\\share\\enjuewemela.hs'

*** why ?
paths provided by xdg.BaseDirectory have not much sense in windows.

*** workaround patch
I will paste here the bzr diff, seems that launchpad bug tracker don't allow to attach a file

=== modified file 'enjuewemela/main.py'
--- enjuewemela/main.py 2011-08-16 21:31:53 +0000
+++ enjuewemela/main.py 2011-09-08 14:27:15 +0000
@@ -11,6 +11,12 @@
 import os
 import sys

+# workaround for xdg problem in windows, corrects paths to config and hiscores
+import xdg.BaseDirectory as xd
+if sys.platform == 'win32':
+ xd.xdg_config_home = os.path.expanduser('~\\')
+ xd.xdg_data_home = xd.xdg_config_home
+
 import config

 from cocos.director import director

Revision history for this message
ccanepa (ccanepacc) wrote :

Ah, la opcion de attach es visible solo despues de postear el bug. Bueno, adiciono el diff.

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.