From 08f0717e0f1cefc322b25cce3ee34687fee5f1ef Mon Sep 17 00:00:00 2001 From: Felipe Tavares Date: Sun, 24 Nov 2019 20:35:55 -0300 Subject: [PATCH] Open files in binary mode. --- src/apps/system/cp.nib/main.lua | 6 +++--- src/apps/system/mv.nib/main.lua | 6 +++--- src/apps/system/new.nib/main.lua | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/apps/system/cp.nib/main.lua b/src/apps/system/cp.nib/main.lua index 03db6db..bf403b9 100644 --- a/src/apps/system/cp.nib/main.lua +++ b/src/apps/system/cp.nib/main.lua @@ -1,11 +1,11 @@ function copy_file(from, to) - local f_from = io.open(from, 'r') + local f_from = io.open(from, 'rb') if f_from then local content = f_from:read('*all') if content then - local f_to = io.open(to, 'w') + local f_to = io.open(to, 'wb') if f_to then f_to:write(content) @@ -26,4 +26,4 @@ function init() end stop_app(0) -end \ No newline at end of file +end diff --git a/src/apps/system/mv.nib/main.lua b/src/apps/system/mv.nib/main.lua index a4439e5..31819e5 100644 --- a/src/apps/system/mv.nib/main.lua +++ b/src/apps/system/mv.nib/main.lua @@ -1,11 +1,11 @@ function move_file(from, to) - local f_from = io.open(from, 'r') + local f_from = io.open(from, 'rb') if f_from then local content = f_from:read('*all') if content then - local f_to = io.open(to, 'w') + local f_to = io.open(to, 'wb') f_to:write(content) @@ -28,4 +28,4 @@ function init() end stop_app(0) -end \ No newline at end of file +end diff --git a/src/apps/system/new.nib/main.lua b/src/apps/system/new.nib/main.lua index 565fb6d..f505f44 100644 --- a/src/apps/system/new.nib/main.lua +++ b/src/apps/system/new.nib/main.lua @@ -17,7 +17,7 @@ function make_file(file) end function copy_file(from, to) - local original = io.open(from, "r") + local original = io.open(from, "rb") if original then local content = original:read("*all") @@ -25,7 +25,7 @@ function copy_file(from, to) if content then make_file(to) - local destination = io.open(to, "w") + local destination = io.open(to, "wb") if destination then destination:write(content)