#
# Modified cache and stats files belong to $HOME not /usr/share/fofix
#
--- old/src/Player.py	2009-10-04 19:55:41.000000000 -0400
+++ old/src/Player.py	2009-10-04 20:11:17.000000000 -0400
@@ -31,6 +31,7 @@
 import Scorekeeper
 import os
 import sys
+import shutil
 from Language import _
 #import Dialogs
 import Microphone  #stump
@@ -230,6 +231,19 @@
   controlpath = os.path.join("..",controlpath)
   playerpath  = os.path.join("..",playerpath)
 
+#stump: permission fix for read-only system-wide installation
+if not os.path.isfile(os.path.join(playerpath, 'FoFiX-players.cache')):
+  baseuserpath = os.path.join(Resource.getWritableResourcePath(), 'users')
+  newcontrolpath = os.path.join(baseuserpath, 'controllers')
+  newplayerpath = os.path.join(baseuserpath, 'players')
+  for old, new in [(controlpath, newcontrolpath), (playerpath, newplayerpath)]:
+    if not os.path.isdir(new):
+      os.makedirs(new)
+    for f in os.listdir(old):
+      shutil.copy(os.path.join(old, f), os.path.join(new, f))
+  controlpath = newcontrolpath
+  playerpath = newplayerpath
+
 control0 = None
 control1 = None
 control2 = None
