Browse Source

use path.exists

nagadomi 10 years ago
parent
commit
11ff1d54ce
1 changed files with 1 additions and 11 deletions
  1. 1 11
      waifu2x.lua

+ 1 - 11
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()