From 229a7d18c94149514d6fcbe209852f3820f57231 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 14 Dec 2021 00:00:23 +0100 Subject: global-functions: $DownloadPackage: make directory first The fetch command creates the directory itself, however using $MkDir gives better error message when creating directory fails. --- global-functions | 6 ++++++ 1 file changed, 6 insertions(+) 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; -- cgit v1.2.3-70-g09d2