aboutsummaryrefslogtreecommitdiffstats
path: root/global-functions.rsc
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-03-28 11:07:45 +0200
committerGravatar Christian Hesse <mail@eworm.de>2023-03-28 15:43:35 +0200
commit7fdec1abed5be3c7dc651cdd6b878519c848f15f (patch)
tree353c0f31604f7856aea06454b308ab46135d62bb /global-functions.rsc
parentd3ca5063947f4350721cfe1828faae2cd771f133 (diff)
global-functions: $MkDir: add extra block for indention...
... to make the next commit cleaner. No functional change.
Diffstat (limited to 'global-functions.rsc')
-rw-r--r--global-functions.rsc62
1 files changed, 32 insertions, 30 deletions
diff --git a/global-functions.rsc b/global-functions.rsc
index 2eb0416..3f0aa6a 100644
--- a/global-functions.rsc
+++ b/global-functions.rsc
@@ -590,41 +590,43 @@
:return true;
}
- :local Error false;
- :local PathNext "";
- :foreach Dir in=[ :toarray [ $CharacterReplace $Path "/" "," ] ] do={
- :local Continue false;
- :set PathNext [ $CleanFilePath ($PathNext . "/" . $Dir) ];
-
- :if ([ :len [ /file/find where name=$PathNext !(name="tmpfs") type="directory" ] ] = 1) do={
- :set Continue true;
- }
-
- :if ($Continue = false && $PathNext = "tmpfs") do={
- :if ([ $MkTmpfs ] = false) do={
- :return false;
+ {
+ :local Error false;
+ :local PathNext "";
+ :foreach Dir in=[ :toarray [ $CharacterReplace $Path "/" "," ] ] do={
+ :local Continue false;
+ :set PathNext [ $CleanFilePath ($PathNext . "/" . $Dir) ];
+
+ :if ([ :len [ /file/find where name=$PathNext !(name="tmpfs") type="directory" ] ] = 1) do={
+ :set Continue true;
}
- :set Continue true;
- }
- :if ($Continue = false && [ :len [ /file/find where name=$PathNext ] ] = 1) do={
- $LogPrintExit2 warning $0 ("The path '" . $PathNext . "' exists, but is not a directory.") false;
- :return false;
- }
-
- :if ($Continue = false) do={
- :local Name ($PathNext . "-" . [ $GetRandom20CharAlNum 6 ]);
- :do {
- /ip/smb/share/add disabled=yes directory=$PathNext name=$Name;
- $WaitForFile $PathNext;
- } on-error={
- $LogPrintExit2 warning $0 ("Making directory '" . $PathNext . "' failed!") false;
- :set Error true;
+ :if ($Continue = false && $PathNext = "tmpfs") do={
+ :if ([ $MkTmpfs ] = false) do={
+ :return false;
+ }
+ :set Continue true;
}
- /ip/smb/share/remove [ find where name=$Name ];
- :if ($Error = true) do={
+
+ :if ($Continue = false && [ :len [ /file/find where name=$PathNext ] ] = 1) do={
+ $LogPrintExit2 warning $0 ("The path '" . $PathNext . "' exists, but is not a directory.") false;
:return false;
}
+
+ :if ($Continue = false) do={
+ :local Name ($PathNext . "-" . [ $GetRandom20CharAlNum 6 ]);
+ :do {
+ /ip/smb/share/add disabled=yes directory=$PathNext name=$Name;
+ $WaitForFile $PathNext;
+ } on-error={
+ $LogPrintExit2 warning $0 ("Making directory '" . $PathNext . "' failed!") false;
+ :set Error true;
+ }
+ /ip/smb/share/remove [ find where name=$Name ];
+ :if ($Error = true) do={
+ :return false;
+ }
+ }
}
}
:return true;