42
42
43
43
local function _win_os_execute (cmd )
44
44
local result = nil
45
- local p = dsys . io_popen (cmd )
45
+ local p = io.popen (cmd )
46
46
local output = p :read (" *a" )
47
47
p :close ()
48
48
if string.match (output , " true" ) then
@@ -94,7 +94,7 @@ dtutils_file.libdoc.functions["test_file"] = {
94
94
95
95
function dtutils_file .test_file (path , test )
96
96
local cmd = " test -"
97
- local engine = dsys . os_execute
97
+ local engine = os.execute
98
98
local cmdstring = " "
99
99
100
100
if dt .configuration .running_os == " windows" then
@@ -167,7 +167,7 @@ local function _search_for_bin_windows(bin)
167
167
168
168
for _ ,arg in ipairs (args ) do
169
169
local cmd = " where " .. arg .. " " .. ds .sanitize (bin )
170
- local p = dsys . io_popen (cmd )
170
+ local p = io.popen (cmd )
171
171
local output = p :read (" *a" )
172
172
p :close ()
173
173
local lines = du .split (output , " \n " )
191
191
192
192
local function _search_for_bin_nix (bin )
193
193
local result = false
194
- local p = dsys . io_popen (" command -v " .. bin )
194
+ local p = io.popen (" command -v " .. bin )
195
195
local output = p :read (" *a" )
196
196
p :close ()
197
197
if string.len (output ) > 0 then
@@ -220,7 +220,7 @@ local function _search_for_bin_macos(bin)
220
220
search_start = " /Applications/" .. bin .. " .app"
221
221
end
222
222
223
- local p = dsys . io_popen (" find " .. search_start .. " -type f -name " .. bin .. " -print" )
223
+ local p = io.popen (" find " .. search_start .. " -type f -name " .. bin .. " -print" )
224
224
local output = p :read (" *a" )
225
225
p :close ()
226
226
local lines = du .split (output , " \n " )
@@ -445,7 +445,7 @@ function dtutils_file.check_if_file_exists(filepath)
445
445
local result = false
446
446
if (dt .configuration .running_os == ' windows' ) then
447
447
filepath = string.gsub (filepath , ' [\\ /]+' , ' \\ ' )
448
- local p = dsys . io_popen (" if exist " .. dtutils_file .sanitize_filename (filepath ) .. " (echo 'yes') else (echo 'no')" )
448
+ local p = io.popen (" if exist " .. dtutils_file .sanitize_filename (filepath ) .. " (echo 'yes') else (echo 'no')" )
449
449
local ans = p :read (" *all" )
450
450
p :close ()
451
451
if string.match (ans , " yes" ) then
@@ -456,7 +456,7 @@ function dtutils_file.check_if_file_exists(filepath)
456
456
-- result = false
457
457
-- end
458
458
elseif (dt .configuration .running_os == " linux" ) then
459
- result = dsys . os_execute (' test -e ' .. dtutils_file .sanitize_filename (filepath ))
459
+ result = os.execute (' test -e ' .. dtutils_file .sanitize_filename (filepath ))
460
460
if not result then
461
461
result = false
462
462
end
@@ -522,9 +522,9 @@ function dtutils_file.file_copy(fromFile, toFile)
522
522
local result = nil
523
523
-- if cp exists, use it
524
524
if dt .configuration .running_os == " windows" then
525
- result = dsys . os_execute (' copy "' .. fromFile .. ' " "' .. toFile .. ' "' )
525
+ result = os.execute (' copy "' .. fromFile .. ' " "' .. toFile .. ' "' )
526
526
elseif dtutils_file .check_if_bin_exists (" cp" ) then
527
- result = dsys . os_execute (" cp '" .. fromFile .. " ' '" .. toFile .. " '" )
527
+ result = os.execute (" cp '" .. fromFile .. " ' '" .. toFile .. " '" )
528
528
end
529
529
530
530
-- if cp was not present, or if cp failed, then a pure lua solution
@@ -575,7 +575,7 @@ function dtutils_file.file_move(fromFile, toFile)
575
575
if not success then
576
576
-- an error occurred, so let's try using the operating system function
577
577
if dtutils_file .check_if_bin_exists (" mv" ) then
578
- success = dsys . os_execute (" mv '" .. fromFile .. " ' '" .. toFile .. " '" )
578
+ success = os.execute (" mv '" .. fromFile .. " ' '" .. toFile .. " '" )
579
579
end
580
580
-- if the mv didn't exist or succeed, then...
581
581
if not success then
0 commit comments