-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathscript.js
More file actions
49 lines (41 loc) · 1.4 KB
/
script.js
File metadata and controls
49 lines (41 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
const InstallerScript = include("engines.wine.quick_script.installer_script");
const Downloader = include("utils.functions.net.download");
const { createTempFile } = include("utils.functions.filesystem.files");
module.default = class OnlineInstallerScript extends InstallerScript {
constructor() {
super();
this._installationArgs = [];
}
url(url) {
this._url = url;
return this;
}
checksum(checksum) {
this._checksum = checksum;
return this;
}
installationArgs(installationArgs) {
if (typeof installationArgs === 'string' || installationArgs instanceof String) {
this._installationArgs = [installationArgs];
} else {
this._installationArgs = installationArgs;
}
return this;
}
_installationCommand(wizard) {
// if no URL given, ask user
if (!this._url) {
this._url = wizard.textbox(tr("Please select the download URL."));
}
// get correct extension depending on URL
const extension = this._url.split('.').pop();
const installationFile = createTempFile(extension);
new Downloader()
.wizard(wizard)
.url(this._url)
.checksum(this._checksum)
.to(installationFile)
.get();
return { command: installationFile, args: this._installationArgs };
}
}