mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
global-functions: $DownloadPackage: make directory first
The fetch command creates the directory itself, however using $MkDir gives better error message when creating directory fails.
This commit is contained in:
parent
5846b85e28
commit
229a7d18c9
1 changed files with 6 additions and 0 deletions
|
@ -251,6 +251,7 @@
|
||||||
:global CertificateAvailable;
|
:global CertificateAvailable;
|
||||||
:global CleanFilePath;
|
:global CleanFilePath;
|
||||||
:global LogPrintExit2;
|
:global LogPrintExit2;
|
||||||
|
:global MkDir;
|
||||||
:global WaitForFile;
|
:global WaitForFile;
|
||||||
|
|
||||||
:if ([ :len $PkgName ] = 0) do={ :return false; }
|
:if ([ :len $PkgName ] = 0) do={ :return false; }
|
||||||
|
@ -263,6 +264,11 @@
|
||||||
}
|
}
|
||||||
:local PkgDest [ $CleanFilePath ($PkgDir . "/" . $PkgFile) ];
|
: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={
|
:if ([ :len [ / file find where name=$PkgDest type="package" ] ] > 0) do={
|
||||||
$LogPrintExit2 info $0 ("Package file " . $PkgName . " already exists.") false;
|
$LogPrintExit2 info $0 ("Package file " . $PkgName . " already exists.") false;
|
||||||
:return true;
|
:return true;
|
||||||
|
|
Loading…
Reference in a new issue