From 14ba52d95a9c190e10ec3e3371477144814fcc00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Fri, 2 Dec 2016 09:14:33 +0800 Subject: [PATCH] Fixed to work with different line terminators on Linux. --- oobsync.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/oobsync.py b/oobsync.py index 3f3d3ef..89520d4 100755 --- a/oobsync.py +++ b/oobsync.py @@ -121,7 +121,8 @@ def read_in_source_dir(projdir): if os.path.isfile(path) and entry.lower().endswith(".vb"): modname = entry[0:-3] f = open(path) - modules[modname] = f.read().decode("utf-8") + modules[modname] = f.read().decode("utf-8").replace( + "\r\n", "\n") f.close() return modules @@ -144,7 +145,7 @@ def update_source_dir(projdir, modules): else: path = os.path.join(projdir, curmods[modname]) f = open(path, "r+") - if modules[modname] != f.read(): + if modules[modname] != f.read().replace("\r\n", "\n"): f.seek(0) f.write(modules[modname]) print >> sys.stderr, curmods[modname] + " updated."