aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2021-12-14 00:00:23 +0100
committerGravatar Christian Hesse <mail@eworm.de>2021-12-14 00:10:30 +0100
commit229a7d18c94149514d6fcbe209852f3820f57231 (patch)
tree3c157ba18c7619235de7228411dc39df9fd5b8a4
parent5846b85e287186d85c6e194debacae47af77d06a (diff)
global-functions: $DownloadPackage: make directory first
The fetch command creates the directory itself, however using $MkDir gives better error message when creating directory fails.
-rw-r--r--global-functions6
1 files changed, 6 insertions, 0 deletions
diff --git a/global-functions b/global-functions
index 2163f73..4ff2a7a 100644
--- a/global-functions
+++ b/global-functions
@@ -251,6 +251,7 @@
:global CertificateAvailable;
:global CleanFilePath;
:global LogPrintExit2;
+ :global MkDir;
:global WaitForFile;
:if ([ :len $PkgName ] = 0) do={ :return false; }
@@ -263,6 +264,11 @@
}
:local PkgDest [ $CleanFilePath ($PkgDir . "/" . $PkgFile) ];
+ :if ([ $MkDir $PkgDir ] = false) do={
+ $LogPrintExit2 warning $0 ("Failed creating directory, not downloading package.") false;
+ :return false;
+ }
+
:if ([ :len [ / file find where name=$PkgDest type="package" ] ] > 0) do={
$LogPrintExit2 info $0 ("Package file " . $PkgName . " already exists.") false;
:return true;