From f6056adf3de0c1845ee31a745c775df825e1d71f Mon Sep 17 00:00:00 2001 From: Walter Duque de Estrada Date: Sun, 29 Jan 2023 15:51:02 -0600 Subject: [PATCH 1/7] OnlineInstallerScript now will ask for wine settings --- Engines/Wine/QuickScript/Online Installer Script/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engines/Wine/QuickScript/Online Installer Script/script.js b/Engines/Wine/QuickScript/Online Installer Script/script.js index e021e495bf1..6999fdf3822 100644 --- a/Engines/Wine/QuickScript/Online Installer Script/script.js +++ b/Engines/Wine/QuickScript/Online Installer Script/script.js @@ -5,7 +5,7 @@ const { createTempFile } = include("utils.functions.filesystem.files"); module.default = class OnlineInstallerScript extends InstallerScript { constructor() { super(); - + this._wineUserSettings = true; this._installationArgs = []; } From fc41ac7d0765062b215f65211a44cea240271641 Mon Sep 17 00:00:00 2001 From: Walter Duque de Estrada Date: Fri, 3 Feb 2023 21:48:42 -0600 Subject: [PATCH 2/7] OnlineInstallerScript back to original Add conditions for MacOSX --- Engines/Wine/Engine/Versions/script.js | 16 +++++++++++++--- .../Online Installer Script/script.js | 1 - Engines/Wine/QuickScript/Quick Script/script.js | 5 +++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Engines/Wine/Engine/Versions/script.js b/Engines/Wine/Engine/Versions/script.js index 16e7b42858b..baf69c0bb39 100644 --- a/Engines/Wine/Engine/Versions/script.js +++ b/Engines/Wine/Engine/Versions/script.js @@ -1,6 +1,7 @@ const { cat, touch } = include("utils.functions.filesystem.files"); const Downloader = include("utils.functions.net.download"); const propertyReader = Bean("propertyReader"); +const operatingSystemFetcher = Bean("operatingSystemFetcher"); /** * Sorts an array of Wine versions in place @@ -122,15 +123,24 @@ module.getAvailableVersions = function (wizard) { module.getLatestStableVersion = function (wizard, architecture) { - return getLatestVersion(wizard, "upstream-linux-" + architecture, /^\d+\.0(\.\d+)?$/); + const os = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage() + const arch = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage() === "darwin" ? "x86on64" : "x86"; + const distribution = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage() === "darwin" ? "cx" : "upstream"; + return getLatestVersion(wizard, `${distribution}-${os}-${arch}`, /^\d+\.0(\.\d+)?$/); } module.getLatestDevelopmentVersion = function (wizard, architecture) { - return getLatestVersion(wizard, "upstream-linux-" + architecture, /^\d+\.\d+(\.\d+)?$/); + const os = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage() + const arch = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage() === "darwin" ? "x86on64" : "x86"; + const distribution = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage() === "darwin" ? "cx" : "upstream"; + return getLatestVersion(wizard, `${distribution}-${os}-${arch}`, /^\d+\.0(\.\d+)?$/); } module.getLatestStagingVersion = function (wizard, architecture) { - return getLatestVersion(wizard, "staging-linux-" + architecture, /^\d+\.\d+(\.\d+)?$/); + const os = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage() + const arch = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage() === "darwin" ? "x86on64" : "x86"; + const distribution = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage() === "darwin" ? "cx" : "staging"; + return getLatestVersion(wizard, `${distribution}-${os}-${arch}`, /^\d+\.0(\.\d+)?$/); } module.getLatestDosSupportVersion = function (/*wizard, architecture*/) { diff --git a/Engines/Wine/QuickScript/Online Installer Script/script.js b/Engines/Wine/QuickScript/Online Installer Script/script.js index 6999fdf3822..bef2e8011cc 100644 --- a/Engines/Wine/QuickScript/Online Installer Script/script.js +++ b/Engines/Wine/QuickScript/Online Installer Script/script.js @@ -5,7 +5,6 @@ const { createTempFile } = include("utils.functions.filesystem.files"); module.default = class OnlineInstallerScript extends InstallerScript { constructor() { super(); - this._wineUserSettings = true; this._installationArgs = []; } diff --git a/Engines/Wine/QuickScript/Quick Script/script.js b/Engines/Wine/QuickScript/Quick Script/script.js index f906c8f8177..b5f3248bbf7 100644 --- a/Engines/Wine/QuickScript/Quick Script/script.js +++ b/Engines/Wine/QuickScript/Quick Script/script.js @@ -1,11 +1,12 @@ const { getLatestStableVersion } = include("engines.wine.engine.versions"); const WineShortcut = include("engines.wine.shortcuts.wine"); +const operatingSystemFetcher = Bean("operatingSystemFetcher"); module.default = class QuickScript { constructor() { this._wineVersionFunction = getLatestStableVersion; - this._wineArchitecture = "x86"; - this._wineDistribution = "upstream"; + this._wineArchitecture = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage() === "darwin" ? "x86on64" : "x86"; + this._wineDistribution = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage() === "darwin" ? "cx" : "upstream"; this._wineUserSettings = false; this._type = "Applications"; From f3d75b2eaf26c0a82b7cd54e47903d8a365c153f Mon Sep 17 00:00:00 2001 From: Walter Duque de Estrada Date: Sun, 5 Feb 2023 17:55:19 -0600 Subject: [PATCH 3/7] Consolidate defintions --- Engines/Wine/Engine/Versions/script.js | 16 ++++------------ Engines/Wine/QuickScript/Quick Script/script.js | 5 +++-- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/Engines/Wine/Engine/Versions/script.js b/Engines/Wine/Engine/Versions/script.js index baf69c0bb39..4b5df257bd2 100644 --- a/Engines/Wine/Engine/Versions/script.js +++ b/Engines/Wine/Engine/Versions/script.js @@ -123,24 +123,16 @@ module.getAvailableVersions = function (wizard) { module.getLatestStableVersion = function (wizard, architecture) { - const os = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage() - const arch = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage() === "darwin" ? "x86on64" : "x86"; - const distribution = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage() === "darwin" ? "cx" : "upstream"; - return getLatestVersion(wizard, `${distribution}-${os}-${arch}`, /^\d+\.0(\.\d+)?$/); + return getLatestVersion(wizard, `${this._wineDistribution}-${this._winePackage}-${architecture}`, /^\d+\.0(\.\d+)?$/); } module.getLatestDevelopmentVersion = function (wizard, architecture) { - const os = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage() - const arch = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage() === "darwin" ? "x86on64" : "x86"; - const distribution = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage() === "darwin" ? "cx" : "upstream"; - return getLatestVersion(wizard, `${distribution}-${os}-${arch}`, /^\d+\.0(\.\d+)?$/); + return getLatestVersion(wizard, `${this._wineDistribution}-${this._winePackage}-${architecture}`, /^\d+\.0(\.\d+)?$/); } module.getLatestStagingVersion = function (wizard, architecture) { - const os = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage() - const arch = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage() === "darwin" ? "x86on64" : "x86"; - const distribution = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage() === "darwin" ? "cx" : "staging"; - return getLatestVersion(wizard, `${distribution}-${os}-${arch}`, /^\d+\.0(\.\d+)?$/); + const distribution = this._winePackage === "darwin" ? "cx" : "staging"; + return getLatestVersion(wizard, `${distribution}-${this._winePackage}-${architecture}`, /^\d+\.0(\.\d+)?$/); } module.getLatestDosSupportVersion = function (/*wizard, architecture*/) { diff --git a/Engines/Wine/QuickScript/Quick Script/script.js b/Engines/Wine/QuickScript/Quick Script/script.js index b5f3248bbf7..534def08f0d 100644 --- a/Engines/Wine/QuickScript/Quick Script/script.js +++ b/Engines/Wine/QuickScript/Quick Script/script.js @@ -4,9 +4,10 @@ const operatingSystemFetcher = Bean("operatingSystemFetcher"); module.default = class QuickScript { constructor() { + this._winePackage = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage() + this._wineArchitecture = this._winePackage === "darwin" ? "x86on64" : "x86"; + this._wineDistribution = this._winePackage === "darwin" ? "cx" : "upstream"; this._wineVersionFunction = getLatestStableVersion; - this._wineArchitecture = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage() === "darwin" ? "x86on64" : "x86"; - this._wineDistribution = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage() === "darwin" ? "cx" : "upstream"; this._wineUserSettings = false; this._type = "Applications"; From df6cf9d28e7d1ee4ee82147410e530a2cb017acc Mon Sep 17 00:00:00 2001 From: Walter Duque de Estrada Date: Mon, 6 Feb 2023 22:15:28 -0600 Subject: [PATCH 4/7] Codacy fix --- Engines/Wine/Engine/Versions/script.js | 1 - 1 file changed, 1 deletion(-) diff --git a/Engines/Wine/Engine/Versions/script.js b/Engines/Wine/Engine/Versions/script.js index 4b5df257bd2..9cb08953e27 100644 --- a/Engines/Wine/Engine/Versions/script.js +++ b/Engines/Wine/Engine/Versions/script.js @@ -1,7 +1,6 @@ const { cat, touch } = include("utils.functions.filesystem.files"); const Downloader = include("utils.functions.net.download"); const propertyReader = Bean("propertyReader"); -const operatingSystemFetcher = Bean("operatingSystemFetcher"); /** * Sorts an array of Wine versions in place From 2689aa2c42a0be360ebe33beb5a324717122a57c Mon Sep 17 00:00:00 2001 From: Walter Duque de Estrada Date: Sun, 12 Feb 2023 15:59:13 -0600 Subject: [PATCH 5/7] Address latest PR comments --- Engines/Wine/Engine/Versions/script.js | 120 +++++++++--------- .../Wine/QuickScript/Quick Script/script.js | 2 +- 2 files changed, 62 insertions(+), 60 deletions(-) diff --git a/Engines/Wine/Engine/Versions/script.js b/Engines/Wine/Engine/Versions/script.js index 9cb08953e27..7c56e47f481 100644 --- a/Engines/Wine/Engine/Versions/script.js +++ b/Engines/Wine/Engine/Versions/script.js @@ -1,4 +1,4 @@ -const { cat, touch } = include("utils.functions.filesystem.files"); +const {cat, touch} = include("utils.functions.filesystem.files"); const Downloader = include("utils.functions.net.download"); const propertyReader = Bean("propertyReader"); @@ -8,65 +8,64 @@ const propertyReader = Bean("propertyReader"); * @returns {void} */ function sortVersions(versions) { - versions.sort((a, b) => - { - // check version format - const versionRegExp = /^(\d+\.\d+(\.\d+)?)(.*)?$/; - if (!versionRegExp.test(a.version)) { - throw new Error(`invalid Wine version "${a.version}`); - } - if (!versionRegExp.test(b.version)) { - throw new Error(`invalid Wine version "${a.version}`); - } - - // sort - const aVersionParts = a.version.match(versionRegExp); - const bVersionParts = b.version.match(versionRegExp); - - const aVersionNumbers = Array.from(aVersionParts[1].split('.')).map(item => Number(item)); - const bVersionNumbers = Array.from(bVersionParts[1].split('.')).map(item => Number(item)); - - // ensure that cases where not all version numbers (major, minor, patch) are set are handled correctly - const maxVersionIdx = 2; - for (let i = 0; i <= maxVersionIdx; i++) { - if (typeof aVersionNumbers[i] === 'undefined') { - aVersionNumbers[i] = 0; + versions.sort((a, b) => { + // check version format + const versionRegExp = /^(\d+\.\d+(\.\d+)?)(.*)?$/; + if (!versionRegExp.test(a.version)) { + throw new Error(`invalid Wine version "${a.version}`); } - if (typeof bVersionNumbers[i] === 'undefined') { - bVersionNumbers[i] = 0; + if (!versionRegExp.test(b.version)) { + throw new Error(`invalid Wine version "${a.version}`); } - } - // ensure that cases where the description is not set are handled correctly - let aVersionDescription = aVersionParts[3]; - if (typeof aVersionDescription === 'undefined') { - aVersionDescription = ""; - } + // sort + const aVersionParts = a.version.match(versionRegExp); + const bVersionParts = b.version.match(versionRegExp); + + const aVersionNumbers = Array.from(aVersionParts[1].split('.')).map(item => Number(item)); + const bVersionNumbers = Array.from(bVersionParts[1].split('.')).map(item => Number(item)); + + // ensure that cases where not all version numbers (major, minor, patch) are set are handled correctly + const maxVersionIdx = 2; + for (let i = 0; i <= maxVersionIdx; i++) { + if (typeof aVersionNumbers[i] === 'undefined') { + aVersionNumbers[i] = 0; + } + if (typeof bVersionNumbers[i] === 'undefined') { + bVersionNumbers[i] = 0; + } + } - let bVersionDescription = bVersionParts[3]; - if (typeof bVersionDescription === 'undefined') { - bVersionDescription = ""; - } + // ensure that cases where the description is not set are handled correctly + let aVersionDescription = aVersionParts[3]; + if (typeof aVersionDescription === 'undefined') { + aVersionDescription = ""; + } - // major - if (aVersionNumbers[0] != bVersionNumbers[0]) { - return aVersionNumbers[0] - bVersionNumbers[0]; - } - // minor - if (aVersionNumbers[1] != bVersionNumbers[1]) { - return aVersionNumbers[1] - bVersionNumbers[1]; - } - // patch - if (aVersionNumbers[2] != bVersionNumbers[2]) { - return aVersionNumbers[2] - bVersionNumbers[2]; - } - // description - if (aVersionDescription < bVersionDescription) { - return -1; - } else { - return 1; + let bVersionDescription = bVersionParts[3]; + if (typeof bVersionDescription === 'undefined') { + bVersionDescription = ""; + } + + // major + if (aVersionNumbers[0] != bVersionNumbers[0]) { + return aVersionNumbers[0] - bVersionNumbers[0]; + } + // minor + if (aVersionNumbers[1] != bVersionNumbers[1]) { + return aVersionNumbers[1] - bVersionNumbers[1]; + } + // patch + if (aVersionNumbers[2] != bVersionNumbers[2]) { + return aVersionNumbers[2] - bVersionNumbers[2]; + } + // description + if (aVersionDescription < bVersionDescription) { + return -1; + } else { + return 1; + } } - } ); } @@ -86,10 +85,10 @@ function getLatestVersion(wizard, category, regex) { const regExp = new RegExp(regex); const versions = packages - .filter(({ version }) => regExp.test(version)) + .filter(({version}) => regExp.test(version)) .map(packageData => packageData.version); - return versions[versions.length-1]; + return versions[versions.length - 1]; } /** @@ -120,9 +119,12 @@ module.getAvailableVersions = function (wizard) { return versionsJson; } - module.getLatestStableVersion = function (wizard, architecture) { - return getLatestVersion(wizard, `${this._wineDistribution}-${this._winePackage}-${architecture}`, /^\d+\.0(\.\d+)?$/); + return getLatestStableVersion(wizard, this._wineDistribution, this._winePackage, architecture); +} + +module.getLatestStableVersion = function (wizard, distribution, winePackage, architecture) { + return getLatestVersion(wizard, `${distribution}-${winePackage}-${architecture}`, /^\d+\.0(\.\d+)?$/); } module.getLatestDevelopmentVersion = function (wizard, architecture) { @@ -130,7 +132,7 @@ module.getLatestDevelopmentVersion = function (wizard, architecture) { } module.getLatestStagingVersion = function (wizard, architecture) { - const distribution = this._winePackage === "darwin" ? "cx" : "staging"; + const distribution = this._winePackage === "darwin" ? "cx" : "staging"; return getLatestVersion(wizard, `${distribution}-${this._winePackage}-${architecture}`, /^\d+\.0(\.\d+)?$/); } diff --git a/Engines/Wine/QuickScript/Quick Script/script.js b/Engines/Wine/QuickScript/Quick Script/script.js index 534def08f0d..d709ea445b5 100644 --- a/Engines/Wine/QuickScript/Quick Script/script.js +++ b/Engines/Wine/QuickScript/Quick Script/script.js @@ -156,7 +156,7 @@ module.default = class QuickScript { * @returns {void} */ _determineWineVersion(wizard) { - this._wineVersion = this._wineVersionFunction(wizard, this._wineArchitecture); + this._wineVersion = this._wineVersionFunction(wizard, this._wineDistribution, this._winePackage, this._wineArchitecture); } /** From 85f7a6319196796be7339bbeafc3aae3d9a7ffd6 Mon Sep 17 00:00:00 2001 From: Walter Duque de Estrada Date: Tue, 14 Feb 2023 16:24:58 -0600 Subject: [PATCH 6/7] ESLint --- Engines/Wine/Engine/Versions/script.js | 108 ++++++++++++------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/Engines/Wine/Engine/Versions/script.js b/Engines/Wine/Engine/Versions/script.js index 7c56e47f481..e5c01e2170c 100644 --- a/Engines/Wine/Engine/Versions/script.js +++ b/Engines/Wine/Engine/Versions/script.js @@ -1,4 +1,4 @@ -const {cat, touch} = include("utils.functions.filesystem.files"); +const { cat, touch } = include("utils.functions.filesystem.files"); const Downloader = include("utils.functions.net.download"); const propertyReader = Bean("propertyReader"); @@ -9,63 +9,63 @@ const propertyReader = Bean("propertyReader"); */ function sortVersions(versions) { versions.sort((a, b) => { - // check version format - const versionRegExp = /^(\d+\.\d+(\.\d+)?)(.*)?$/; - if (!versionRegExp.test(a.version)) { - throw new Error(`invalid Wine version "${a.version}`); - } - if (!versionRegExp.test(b.version)) { - throw new Error(`invalid Wine version "${a.version}`); - } - - // sort - const aVersionParts = a.version.match(versionRegExp); - const bVersionParts = b.version.match(versionRegExp); - - const aVersionNumbers = Array.from(aVersionParts[1].split('.')).map(item => Number(item)); - const bVersionNumbers = Array.from(bVersionParts[1].split('.')).map(item => Number(item)); - - // ensure that cases where not all version numbers (major, minor, patch) are set are handled correctly - const maxVersionIdx = 2; - for (let i = 0; i <= maxVersionIdx; i++) { - if (typeof aVersionNumbers[i] === 'undefined') { - aVersionNumbers[i] = 0; - } - if (typeof bVersionNumbers[i] === 'undefined') { - bVersionNumbers[i] = 0; - } - } + // check version format + const versionRegExp = /^(\d+\.\d+(\.\d+)?)(.*)?$/; + if (!versionRegExp.test(a.version)) { + throw new Error(`invalid Wine version "${a.version}`); + } + if (!versionRegExp.test(b.version)) { + throw new Error(`invalid Wine version "${a.version}`); + } - // ensure that cases where the description is not set are handled correctly - let aVersionDescription = aVersionParts[3]; - if (typeof aVersionDescription === 'undefined') { - aVersionDescription = ""; - } + // sort + const aVersionParts = a.version.match(versionRegExp); + const bVersionParts = b.version.match(versionRegExp); - let bVersionDescription = bVersionParts[3]; - if (typeof bVersionDescription === 'undefined') { - bVersionDescription = ""; - } + const aVersionNumbers = Array.from(aVersionParts[1].split('.')).map(item => Number(item)); + const bVersionNumbers = Array.from(bVersionParts[1].split('.')).map(item => Number(item)); - // major - if (aVersionNumbers[0] != bVersionNumbers[0]) { - return aVersionNumbers[0] - bVersionNumbers[0]; - } - // minor - if (aVersionNumbers[1] != bVersionNumbers[1]) { - return aVersionNumbers[1] - bVersionNumbers[1]; - } - // patch - if (aVersionNumbers[2] != bVersionNumbers[2]) { - return aVersionNumbers[2] - bVersionNumbers[2]; + // ensure that cases where not all version numbers (major, minor, patch) are set are handled correctly + const maxVersionIdx = 2; + for (let i = 0; i <= maxVersionIdx; i++) { + if (typeof aVersionNumbers[i] === 'undefined') { + aVersionNumbers[i] = 0; } - // description - if (aVersionDescription < bVersionDescription) { - return -1; - } else { - return 1; + if (typeof bVersionNumbers[i] === 'undefined') { + bVersionNumbers[i] = 0; } } + + // ensure that cases where the description is not set are handled correctly + let aVersionDescription = aVersionParts[3]; + if (typeof aVersionDescription === 'undefined') { + aVersionDescription = ""; + } + + let bVersionDescription = bVersionParts[3]; + if (typeof bVersionDescription === 'undefined') { + bVersionDescription = ""; + } + + // major + if (aVersionNumbers[0] != bVersionNumbers[0]) { + return aVersionNumbers[0] - bVersionNumbers[0]; + } + // minor + if (aVersionNumbers[1] != bVersionNumbers[1]) { + return aVersionNumbers[1] - bVersionNumbers[1]; + } + // patch + if (aVersionNumbers[2] != bVersionNumbers[2]) { + return aVersionNumbers[2] - bVersionNumbers[2]; + } + // description + if (aVersionDescription < bVersionDescription) { + return -1; + } else { + return 1; + } + } ); } @@ -85,7 +85,7 @@ function getLatestVersion(wizard, category, regex) { const regExp = new RegExp(regex); const versions = packages - .filter(({version}) => regExp.test(version)) + .filter(({ version }) => regExp.test(version)) .map(packageData => packageData.version); return versions[versions.length - 1]; @@ -120,7 +120,7 @@ module.getAvailableVersions = function (wizard) { } module.getLatestStableVersion = function (wizard, architecture) { - return getLatestStableVersion(wizard, this._wineDistribution, this._winePackage, architecture); + return getLatestVersion(wizard, `${this._wineDistribution}-${this._winePackage}-${architecture}`, /^\d+\.0(\.\d+)?$/); } module.getLatestStableVersion = function (wizard, distribution, winePackage, architecture) { From 6cdd730c2602858498e82e906f5269bbe816e2b8 Mon Sep 17 00:00:00 2001 From: wduque Date: Sun, 19 Feb 2023 14:37:27 -0600 Subject: [PATCH 7/7] remove getLatestStableVersion one arg. Wondering if getLatestDevelopmentVersion is neeeded --- .../Accessories/MobilePASS/Online/script.js | 2 +- .../Internet Explorer 6.0/Online/script.js | 2 +- .../Internet Explorer 7.0/Online/script.js | 2 +- Engines/Wine/Engine/Versions/script.js | 25 +++++++++++-------- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/Applications/Accessories/MobilePASS/Online/script.js b/Applications/Accessories/MobilePASS/Online/script.js index 53a7aed4532..3405f808a74 100644 --- a/Applications/Accessories/MobilePASS/Online/script.js +++ b/Applications/Accessories/MobilePASS/Online/script.js @@ -42,7 +42,7 @@ new PlainInstaller().withScript(() => { "MobilePass", "upstream", "x86", - getLatestStableVersion(setupWizard, "x86") + getLatestStableVersion(setupWizard, null, null, "x86") ) .create(); diff --git a/Applications/Internet/Internet Explorer 6.0/Online/script.js b/Applications/Internet/Internet Explorer 6.0/Online/script.js index e93d45eacd7..fb3daad2b20 100644 --- a/Applications/Internet/Internet Explorer 6.0/Online/script.js +++ b/Applications/Internet/Internet Explorer 6.0/Online/script.js @@ -31,7 +31,7 @@ new PlainInstaller().withScript(() => { const wine = new Wine() .wizard(setupWizard) - .prefix("InternetExplorer6", "upstream", "x86", getLatestStableVersion(setupWizard, "x86")) + .prefix("InternetExplorer6", "upstream", "x86", getLatestStableVersion(setupWizard, null, null, "x86")) .create(); new Msls31(wine).go(); diff --git a/Applications/Internet/Internet Explorer 7.0/Online/script.js b/Applications/Internet/Internet Explorer 7.0/Online/script.js index f207999312d..2e08b53ffbb 100644 --- a/Applications/Internet/Internet Explorer 7.0/Online/script.js +++ b/Applications/Internet/Internet Explorer 7.0/Online/script.js @@ -21,7 +21,7 @@ new PlainInstaller().withScript(() => { const wine = new Wine() .wizard(setupWizard) - .prefix("InternetExplorer7", "upstream", "x86", getLatestStableVersion(setupWizard, "x86")) + .prefix("InternetExplorer7", "upstream", "x86", getLatestStableVersion(setupWizard, null, null, "x86")) .create(); new Sandbox(wine).go(); diff --git a/Engines/Wine/Engine/Versions/script.js b/Engines/Wine/Engine/Versions/script.js index e5c01e2170c..a0e7edc44e4 100644 --- a/Engines/Wine/Engine/Versions/script.js +++ b/Engines/Wine/Engine/Versions/script.js @@ -87,7 +87,9 @@ function getLatestVersion(wizard, category, regex) { const versions = packages .filter(({ version }) => regExp.test(version)) .map(packageData => packageData.version); - + if (versions.length === 0) { + throw new Error('No valid versions for category ' + category); + } return versions[versions.length - 1]; } @@ -119,21 +121,22 @@ module.getAvailableVersions = function (wizard) { return versionsJson; } -module.getLatestStableVersion = function (wizard, architecture) { - return getLatestVersion(wizard, `${this._wineDistribution}-${this._winePackage}-${architecture}`, /^\d+\.0(\.\d+)?$/); -} -module.getLatestStableVersion = function (wizard, distribution, winePackage, architecture) { - return getLatestVersion(wizard, `${distribution}-${winePackage}-${architecture}`, /^\d+\.0(\.\d+)?$/); + +module.getLatestStableVersion = function (wizard, distribution, _package, architecture) { + const wineDistribution = distribution != null ? distribution : this._wineDistribution; + const winePackage = _package != null ? _package : this._winePackage; + const wineArchitecture = architecture != null ? architecture : this._wineArchitecture; + return getLatestVersion(wizard, `${wineDistribution}-${winePackage}-${wineArchitecture}`, /^\d+\.0(\.\d+)?$/); } -module.getLatestDevelopmentVersion = function (wizard, architecture) { - return getLatestVersion(wizard, `${this._wineDistribution}-${this._winePackage}-${architecture}`, /^\d+\.0(\.\d+)?$/); +module.getLatestDevelopmentVersion = function (wizard) { + return getLatestVersion(wizard, `${this._wineDistribution}-${this._winePackage}-${this._wineArchitecture}`, /^\d+\.0(\.\d+)?$/); } -module.getLatestStagingVersion = function (wizard, architecture) { - const distribution = this._winePackage === "darwin" ? "cx" : "staging"; - return getLatestVersion(wizard, `${distribution}-${this._winePackage}-${architecture}`, /^\d+\.0(\.\d+)?$/); +module.getLatestStagingVersion = function (wizard) { + const wineDistribution = this._winePackage === "darwin" ? "cx" : "staging"; + return getLatestVersion(wizard, `${wineDistribution}-${this._winePackage}-${this._wineArchitecture}`, /^\d+\.0(\.\d+)?$/); } module.getLatestDosSupportVersion = function (/*wizard, architecture*/) {