Browse Source

path: rm empty dir for file path dst

rufengsuixing 5 years ago
parent
commit
405c10a50b
1 changed files with 6 additions and 0 deletions
  1. 6 0
      luasrc/model/cbi/AdGuardHome/base.lua

+ 6 - 0
luasrc/model/cbi/AdGuardHome/base.lua

@@ -57,6 +57,9 @@ o = s:option(Value, "binpath", translate("Bin Path"), translate("AdGuardHome Bin
 o.default     = "/usr/bin/AdGuardHome/AdGuardHome"
 o.datatype    = "string"
 o.validate=function(self, value)
+if fs.stat(value,"type")=="dir" then
+	fs.rmdir(value)
+end
 if fs.stat(value,"type")=="dir" then
 	if (m.message) then
 	m.message =m.message.."\nerror!bin path is a dir"
@@ -116,6 +119,9 @@ o = s:option(Value, "logfile", translate("Runtime log file"), translate("AdGuard
 o.default     = ""
 o.datatype    = "string"
 o.validate=function(self, value)
+if fs.stat(value,"type")=="dir" then
+	fs.rmdir(value)
+end
 if fs.stat(value,"type")=="dir" then
 	if m.message then
 	m.message =m.message.."\nerror!log file is a dir"