Perl natively supports renaming files and create directories.
Do it without calling system().
Signed-off-by: Matteo Croce <teknoraver@meta.com>
Link: https://github.com/openwrt/openwrt/pull/16542
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
use warnings;
use File::Basename;
use File::Copy;
+use File::Path;
use Text::ParseWords;
use JSON::PP;
}
if (! -d "$target") {
- system("mkdir", "-p", "$target/");
+ make_path($target);
}
if (! open TMPDLS, "find $mirror -follow -name $filename 2>/dev/null |") {
};
unlink "$target/$filename";
- system("mv", "$target/$filename.dl", "$target/$filename");
+ move("$target/$filename.dl", "$target/$filename");
cleanup();
}