diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2010-06-11 21:49:37 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2010-06-11 21:49:37 +0000 |
commit | db2717fbfffdac565e4dc4712d37bc76df5a4b4e (patch) | |
tree | 6ff42f2bb793540d53e29107387a8975f6480359 /game/languages | |
parent | 059a6898f9ab5069bd0bf5424b0590d1900325b3 (diff) | |
download | usdx-db2717fbfffdac565e4dc4712d37bc76df5a4b4e.tar.gz usdx-db2717fbfffdac565e4dc4712d37bc76df5a4b4e.tar.xz usdx-db2717fbfffdac565e4dc4712d37bc76df5a4b4e.zip |
- fix execution on windows
- use native line endings for file writing
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2491 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'game/languages')
-rwxr-xr-x | game/languages/update.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/game/languages/update.py b/game/languages/update.py index b148709e..f488b9d9 100755 --- a/game/languages/update.py +++ b/game/languages/update.py @@ -26,7 +26,7 @@ import sys import os import codecs -# buffer english file (always open binary, handle newline uniformly) +# buffer english file (always open binary, handle newline uniformly as "\n") f = open("English.ini", "rbU") english = [] for line in f: @@ -44,6 +44,10 @@ def update(lang): for line in f: translation.append(line.rstrip("\n")) f.close + # WORKAROUND: On windows the file does not seem to be closed by f.close + # as long as it is still referenced. Hence os.rename(lang, oldLang) will + # fail later as the file is still opened for reading. + f = None; outList = [] # find new fields @@ -114,7 +118,9 @@ def update(lang): f = open(lang, 'wb') for line in outList: - f.write(line + "\n") + # binary mode does not convert "\n" to the os specific line-ending. + # Use os.linesep instead. + f.write(line + os.linesep) f.close() # update ini-files |