Skip to content

Commit 1d5192a

Browse files
committed
removed duplpicate copies of the is_ functions
1 parent 04525e1 commit 1d5192a

File tree

1 file changed

+0
-56
lines changed

1 file changed

+0
-56
lines changed

lib/dtutils/file.lua

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -773,61 +773,5 @@ function dtutils_file.rmdir(path)
773773
return dsys.external_command(rm_cmd.." "..path)
774774
end
775775

776-
function dtutils_file.is_dir(path)
777-
local cmd = nil
778-
779-
if dt.configuration.running_os == "windows" then
780-
cmd = "if exist " .. ds.sanitize(path .. "\\*")
781-
else
782-
cmd = "test -d " .. ds.sanitize(path)
783-
end
784-
785-
return os.execute(cmd)
786-
end
787-
788-
function dtutils_file.is_file(path)
789-
local cmd = nil
790-
791-
if dt.configuration.running_os == "windows" then
792-
if not dtutils_file.is_dir(path) then
793-
cmd = "if exist " .. ds.sanitize(path)
794-
else
795-
return nil
796-
end
797-
else
798-
cmd = "test -f " .. ds.sanitize(path)
799-
end
800-
801-
return os.execute(cmd)
802-
end
803-
804-
local function is_windows_executable(path)
805-
local result = nil
806-
807-
if (string.match(path, ".exe$") or string.match(path, ".EXE$")) or
808-
(string.match(path, ".com$") or string.match(path, ".COM$")) or
809-
(string.match(path, ".bat$") or string.match(path, ".BAT$")) or
810-
(string.match(path, ".cmd$") or string.match(path, ".CMD$")) then
811-
result = true
812-
end
813-
return result
814-
end
815-
816-
817-
function dtutils_file.is_executable(path)
818-
819-
local result = nil
820-
821-
if dt.configuration.running_os == "windows" then
822-
if _is_windows_executable(path) then
823-
result = true
824-
end
825-
else
826-
result = os.execute("test -x " .. ds.sanitize(path))
827-
end
828-
return result
829-
end
830-
831-
832776
return dtutils_file
833777

0 commit comments

Comments
 (0)