Encoding pathnames with sys.getfilesystemencoding is always wrong.
On Windows this encodes with the current codepage, which often fails for characters not in the codepage. On Windows, FS functions accept 'unicode' and encode as UTF-16 for WinAPI On Mac, FS functions accept 'unicode' and encode as UTF-8 for FS API On Linux, filenames are byte strings and encoding is only a convention. FS functions encode 'unicode' according to locale. On Linux, it is possible to have files whose names cannot be decoded in any character set!
This commit is contained in:
parent
d330a22453
commit
4c6603371f
@ -159,7 +159,7 @@ this way.
|
||||
self.versions.append(version)
|
||||
|
||||
def jarfileForVersion(self, v):
|
||||
return os.path.join(self.cacheDir, v, "minecraft_server.jar").encode(sys.getfilesystemencoding())
|
||||
return os.path.join(self.cacheDir, v, "minecraft_server.jar")
|
||||
|
||||
def checksumForVersion(self, v):
|
||||
jf = self.jarfileForVersion(v)
|
||||
@ -506,9 +506,6 @@ class MCServerChunkGenerator(object):
|
||||
level.saveChanges()
|
||||
|
||||
def runServer(self, startingDir):
|
||||
if isinstance(startingDir, unicode):
|
||||
startingDir = startingDir.encode(sys.getfilesystemencoding())
|
||||
|
||||
return self._runServer(startingDir, self.serverJarFile)
|
||||
|
||||
lowMemory = False
|
||||
|
Reference in New Issue
Block a user