From 11ff1d54ce08a0a1c6dc18832597680e1c17ff68 Mon Sep 17 00:00:00 2001 From: nagadomi Date: Tue, 26 May 2015 00:25:14 +0900 Subject: [PATCH] use path.exists --- waifu2x.lua | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/waifu2x.lua b/waifu2x.lua index c8ea617..3d8d364 100644 --- a/waifu2x.lua +++ b/waifu2x.lua @@ -59,7 +59,7 @@ local function convert_frames(opt) end fp:close() for i = 1, #lines do - if file_exists(string.format(opt.o, i)) == false then + if path.exists(string.format(opt.o, i)) == false then local x = image_loader.load_float(lines[i]) local new_x = nil if opt.m == "noise" and opt.noise_level == 1 then @@ -97,16 +97,6 @@ local function convert_frames(opt) end end -function file_exists(name) - local f=io.open(name,"r") - if f~=nil then - io.close(f) - return true - else - return false - end -end - local function waifu2x() local cmd = torch.CmdLine() cmd:text()