virtual_sdcard: read new lines as-is

Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
This commit is contained in:
Pedro Lamas 2022-09-06 17:04:14 +01:00 committed by KevinOConnor
parent 30d25834c5
commit f4440267e6
1 changed files with 2 additions and 2 deletions

View File

@ -3,7 +3,7 @@
# Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net> # Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net>
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import os, logging import os, logging, io
VALID_GCODE_EXTS = ['gcode', 'g', 'gco'] VALID_GCODE_EXTS = ['gcode', 'g', 'gco']
@ -177,7 +177,7 @@ class VirtualSD:
if fname not in flist: if fname not in flist:
fname = files_by_lower[fname.lower()] fname = files_by_lower[fname.lower()]
fname = os.path.join(self.sdcard_dirname, fname) fname = os.path.join(self.sdcard_dirname, fname)
f = open(fname, 'r') f = io.open(fname, 'r', newline='')
f.seek(0, os.SEEK_END) f.seek(0, os.SEEK_END)
fsize = f.tell() fsize = f.tell()
f.seek(0) f.seek(0)