FileSystem browseForDirectory + Server.downloadFile
-
@DanH I think you might run into issues with two apps with the same name. You could do what I did, I use one app for both purposes but the download stuff is only active when it's running as a standalone.
-
@d-healey so you supply the plugin and the standalone? and use the standalone for the server stuff?
-
@DanH Correct. You can use
Engine.isPlugin()
to determine if your app is running as a plugin or as standalone and disable/enable stuff accordingly. -
@d-healey ok, but then I guess my idea of making a separate app by the same name might actually work then. Will give it some thought, thanks
-
@d-healey so your app downloads and unpacks several zips, and updates the link file, all with one button?
-
@DanH Yes essentially, but mine uses expansions so there can be multiple link files.
-
@d-healey yes I'm just looking through the code in your repo.
-
If you want to integrate my system into your app send me a message and we can discuss licensing.
-
@d-healey GPL ;)
-
@DanH Even better, take all you want.
-
@d-healey :)
Just going back to the snippet you shared with me earlier, in the download function f needs to be defined as a file but this file will be different for each OS so.... how can I define it as such? Another if statement?
inline function startDownload() { Engine.showYesNoWindow("Select Folder", "Select the destination folder", function(response) { if (response) { FileSystem.browseForDirectory(downloadsFolder, function(dir) { if (isDefined(dir) && dir.isDirectory()) { Server.setBaseURL("https://myserver etc"); var f = dir.getChildFile("MAC-INSTALLER.pkg"); // HERE download = Server.downloadFile(url, {}, f, downloadCallback); } }); } });
-
@DanH Look at the part where I set the URL based on the OS. You can do the same thing for the file name.
-
@d-healey Yes, think I've got it working :crossed_fingers: