Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions Engines/Wine/Engine/Versions/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ const propertyReader = Bean("propertyReader");
* @returns {void}
*/
function sortVersions(versions) {
versions.sort((a, b) =>
{
versions.sort((a, b) => {
// check version format
const versionRegExp = /^(\d+\.\d+(\.\d+)?)(.*)?$/;
if (!versionRegExp.test(a.version)) {
Expand Down Expand Up @@ -89,7 +88,7 @@ function getLatestVersion(wizard, category, regex) {
.filter(({ version }) => regExp.test(version))
.map(packageData => packageData.version);

return versions[versions.length-1];
return versions[versions.length - 1];
}

/**
Expand Down Expand Up @@ -120,17 +119,21 @@ module.getAvailableVersions = function (wizard) {
return versionsJson;
}


module.getLatestStableVersion = function (wizard, architecture) {
return getLatestVersion(wizard, "upstream-linux-" + architecture, /^\d+\.0(\.\d+)?$/);
return getLatestVersion(wizard, `${this._wineDistribution}-${this._winePackage}-${architecture}`, /^\d+\.0(\.\d+)?$/);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea was more:

module.getLatestStableVersion = function (wizard, distribution, package, architecture) {
    return getLatestVersion(wizard, `${distribution}-${package}-${architecture}`, /^\d+\.0(\.\d+)?$/);

Honestly, I don't even understand how the current implementation can work, e.g. this._wineDistribution should not exist here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the field wineDistribution to QuickScript.

}

module.getLatestStableVersion = function (wizard, distribution, winePackage, architecture) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is how it should be. Just remove the other getLatestStableVersion and update getLatestDevelopmentVersion and getLatestStagingVersion. Then, ensure that it's called everywhere with the correct parameters.

return getLatestVersion(wizard, `${distribution}-${winePackage}-${architecture}`, /^\d+\.0(\.\d+)?$/);
}

module.getLatestDevelopmentVersion = function (wizard, architecture) {
return getLatestVersion(wizard, "upstream-linux-" + architecture, /^\d+\.\d+(\.\d+)?$/);
return getLatestVersion(wizard, `${this._wineDistribution}-${this._winePackage}-${architecture}`, /^\d+\.0(\.\d+)?$/);
}

module.getLatestStagingVersion = function (wizard, architecture) {
return getLatestVersion(wizard, "staging-linux-" + architecture, /^\d+\.\d+(\.\d+)?$/);
const distribution = this._winePackage === "darwin" ? "cx" : "staging";
return getLatestVersion(wizard, `${distribution}-${this._winePackage}-${architecture}`, /^\d+\.0(\.\d+)?$/);
}

module.getLatestDosSupportVersion = function (/*wizard, architecture*/) {
Expand Down
1 change: 0 additions & 1 deletion Engines/Wine/QuickScript/Online Installer Script/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const { createTempFile } = include("utils.functions.filesystem.files");
module.default = class OnlineInstallerScript extends InstallerScript {
constructor() {
super();

this._installationArgs = [];
}

Expand Down
8 changes: 5 additions & 3 deletions Engines/Wine/QuickScript/Quick Script/script.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
const { getLatestStableVersion } = include("engines.wine.engine.versions");
const WineShortcut = include("engines.wine.shortcuts.wine");
const operatingSystemFetcher = Bean("operatingSystemFetcher");

module.default = class QuickScript {
constructor() {
this._winePackage = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
this._winePackage = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage()
this._winePackage = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage();

this._wineArchitecture = this._winePackage === "darwin" ? "x86on64" : "x86";
this._wineDistribution = this._winePackage === "darwin" ? "cx" : "upstream";
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prototyped field wineDistribution

this._wineVersionFunction = getLatestStableVersion;
this._wineArchitecture = "x86";
this._wineDistribution = "upstream";
this._wineUserSettings = false;

this._type = "Applications";
Expand Down Expand Up @@ -154,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);
}

/**
Expand Down