From c0daffdc49d706a310348b5bf2c32845ea6d204a Mon Sep 17 00:00:00 2001 From: luboslenco Date: Wed, 3 Feb 2021 19:22:37 +0100 Subject: [PATCH] Cloud download fixes --- Libraries/syslib/Sources/arm/sys/File.hx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Libraries/syslib/Sources/arm/sys/File.hx b/Libraries/syslib/Sources/arm/sys/File.hx index c7650da6..398ea635 100644 --- a/Libraries/syslib/Sources/arm/sys/File.hx +++ b/Libraries/syslib/Sources/arm/sys/File.hx @@ -29,7 +29,11 @@ class File { } public static function createDirectory(path: String) { - Krom.sysCommand("mkdir " + path); + #if krom_windows + Krom.sysCommand("mkdir " + path); // -p by default + #else + Krom.sysCommand("mkdir -p " + path); + #end } public static function copy(srcPath: String, dstPath: String) { @@ -93,21 +97,25 @@ class File { } public static function cacheCloud(path: String): String { - var dest = Path.workingDir() + Path.sep + path; + var dest = Krom.getFilesLocation() + Path.sep + path; if (!File.exists(dest)) { - var fileDir = Krom.getFilesLocation() + Path.sep + path.substr(0, path.lastIndexOf(Path.sep)); + var fileDir = dest.substr(0, dest.lastIndexOf(Path.sep)); File.createDirectory(fileDir); #if krom_windows path = path.replace("\\", "/"); #end var url = Config.raw.server + "/" + path; - File.download(url, path, cloudSizes.get(path)); + File.download(url, dest, cloudSizes.get(path)); if (!File.exists(dest)) { Log.error(Strings.error5()); return null; } } + #if krom_darwin return dest; + #else + return Path.workingDir() + Path.sep + path; + #end } static function initCloud() {