Hello,
Sorry for the dumb question. But some PC users of my games report, that the saveGame.gxl(txt file) is not saved on their PCs.
Is it possible that the PC user does not have access permission to write in that folder?
This is the code:
def makepath(self, string=True):
if os.name == "posix":
path = os.path.dirname(__file__)
path = path.replace("\\", "/")
elif os.name == "nt":
path = str(os.getenv("APPDATA"))+"/CompanyName/GameName/"
path = path.replace("\\", "/")
pathsplit = path.split("/")
correctDir = ""
# if "/" in path[0]:
# correctDir += "/"
for i in range(0, ((len(pathsplit) - 1))):
correctDir += pathsplit[i] + "/"
if string:
return correctDir
else:
return pathsplit
And if it is possible, how to set the permissions.
This is what I use, but still those people report there is no save file:
def makedirectory(self):
if not self.exists():
try:
oriMask = os.umask(0)
os.makedirs(self.basepath, 0o777)
finally:
os.umask(oriMask)
return True
else:
if self.getaccespermissions(os.W_OK):
return True
else:
self.setaccespermissions()
return True
def getaccespermissions(self, permission):
""" get the acces permission of the folder """
return os.access(self.basepath, permission)
def setaccespermissions(self):
""" set the acces permissions of the folder """
os.chmod(self.basepath, 0o777)
Unfortunately on my 5 PCs everything works and I can not reproduce the bug.
Any thoughts?