Fixed compatibility issues. Added new version check to scripts. Renamed lib/dtutils/file/rm() to lib/dtutils/file/rmdir since removing a file in windows with rmdir /q/s results in an error. Fixed os.tmpname() issued in enfuse. Under windows os.tmpname() doesn't put the file in a temporary directory, so fixed it to use darktable.configuration.tmp_dir. Cleaned up documentation in lib/dtutils/system.lua.

This commit is contained in:
Bill Ferguson
2019-02-24 15:19:37 -05:00
parent 32fc4556b1
commit de087f743f
4 changed files with 130 additions and 111 deletions

View File

@@ -582,14 +582,14 @@ function dtutils_file.mkdir(path)
end
end
dtutils_file.libdoc.functions["rmdir"] = {
Name = [[rm]],
dtutils_file.libdoc.functions["rm"] = {
Name = [[rmdir]],
Synopsis = [[recursively remove a directory]],
Usage = [[local df = require "lib/dtutils.file"
df.rmdir(path)
path - string - a directory path]],
Description = [[rmdir recursively removes directories and any files contained within]],
Description = [[rm allow to recursively remove directories]],
Return_Value = [[path - string - a directory path]],
Limitations = [[]],
Example = [[]],
@@ -598,9 +598,10 @@ dtutils_file.libdoc.functions["rmdir"] = {
License = [[]],
Copyright = [[]],
}
function dtutils_file.rmdir(path)
local rmdir_cmd = dt.configuration.running_os == "windows" and "rmdir /S /Q" or "rm -r"
return dsys.external_command(rmdir_cmd.." "..dtutils_file.sanitize_filename(path))
local rm_cmd = dt.configuration.running_os == "windows" and "rmdir /S /Q" or "rm -r"
return dsys.external_command(rm_cmd.." "..dtutils_file.sanitize_filename(path))
end