global-functions: $MkDir: :do ... on-error=... -> :onerror ... do=...

This commit is contained in:
Christian Hesse 2025-05-08 09:27:50 +02:00
parent 7a1fef78a2
commit 09f9826760

View file

@ -894,11 +894,11 @@
$LogPrint info $0 ("Creating disk of type tmpfs."); $LogPrint info $0 ("Creating disk of type tmpfs.");
$RmDir "tmpfs"; $RmDir "tmpfs";
:do { :onerror Err {
/disk/add slot=tmpfs type=tmpfs tmpfs-max-size=([ /system/resource/get total-memory ] / 3); /disk/add slot=tmpfs type=tmpfs tmpfs-max-size=([ /system/resource/get total-memory ] / 3);
$WaitForFile "tmpfs"; $WaitForFile "tmpfs";
} on-error={ } do={
$LogPrint warning $0 ("Creating disk of type tmpfs failed!"); $LogPrint warning $0 ("Creating disk of type tmpfs failed: " . $Err);
:return false; :return false;
} }
:return true; :return true;
@ -923,11 +923,11 @@
} }
} }
:do { :onerror Err {
/file/add type="directory" name=$Path; /file/add type="directory" name=$Path;
$WaitForFile $Path; $WaitForFile $Path;
} on-error={ } do={
$LogPrint warning $0 ("Making directory '" . $Path . "' failed!"); $LogPrint warning $0 ("Making directory '" . $Path . "' failed: " . $Err);
:return false; :return false;
} }