aboutsummaryrefslogtreecommitdiffstats
path: root/global-functions.rsc
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-03-25 21:59:40 +0100
committerGravatar Christian Hesse <mail@eworm.de>2023-03-28 15:43:49 +0200
commitf2e811527206373d91ffa36f4a9662b1adb563d2 (patch)
tree0b9ecc78158c0266dd6198a5577a226061ad8784 /global-functions.rsc
parent7fdec1abed5be3c7dc651cdd6b878519c848f15f (diff)
global-functions: $MkDir: make directory by adding filerouteros-7.9beta4-2
This is new functionality in RouterOS 7.9beta4, where new file can be added with `/file/add ...`. This also creates directories for the full path.
Diffstat (limited to 'global-functions.rsc')
-rw-r--r--global-functions.rsc19
1 files changed, 18 insertions, 1 deletions
diff --git a/global-functions.rsc b/global-functions.rsc
index 3f0aa6a..24b6223 100644
--- a/global-functions.rsc
+++ b/global-functions.rsc
@@ -558,6 +558,7 @@
:global CleanFilePath;
:global GetRandom20CharAlNum;
:global LogPrintExit2;
+ :global RequiredRouterOS;
:global WaitForFile;
:local MkTmpfs do={
@@ -590,7 +591,23 @@
:return true;
}
- {
+ :if ([ $RequiredRouterOS $0 "7.9beta4" false ] = true) do={
+ :if ([ :pick $Path 0 5 ] = "tmpfs") do={
+ :if ([ $MkTmpfs ] = false) do={
+ :return false;
+ }
+ }
+
+ :do {
+ :local File ($Path . "/file");
+ /file/add name=$File;
+ $WaitForFile $File;
+ /file/remove $File;
+ } on-error={
+ $LogPrintExit2 warning $0 ("Making directory '" . $Path . "' failed!") false;
+ :return false;
+ }
+ } else={
:local Error false;
:local PathNext "";
:foreach Dir in=[ :toarray [ $CharacterReplace $Path "/" "," ] ] do={