Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Installers are not handled correctly on Linux (using Lutris or Wine) #299

Open
scrlkx opened this issue May 11, 2024 · 6 comments · May be fixed by #304
Open

[BUG] Installers are not handled correctly on Linux (using Lutris or Wine) #299

scrlkx opened this issue May 11, 2024 · 6 comments · May be fixed by #304
Labels
bug Something isn't working

Comments

@scrlkx
Copy link

scrlkx commented May 11, 2024

Describe the bug
We already have the ability to handle running game installers using Lutris or Wine as you can see here and here.

However, there is something wrong on the lines above it. We have an extra logic that appends a setup.exe to the file path which results in an invalid path to the game file. And, when this path is not found, we just call shell.openPath(gamePath) and, as Linux doesn't know how to open .exe files, it just does it's best opening with Archive Manager or something like that.

That means the lines that handle opening the installer with Lutris or Wine never reach. Removing this piece of code seems to fix the issue, but I assume they are there for a reason?

const setupPath = path.join(gamePath, "setup.exe");
if (!fs.existsSync(setupPath)) {
    shell.openPath(gamePath);
    return true;
}

On the lines above, gamePath is a valid path (pointing to the installer file), but setupPath it's not. fs.existsSync(setupPath) will always be false so we will always do shell.openPath(gamePath);.

To Reproduce
Steps to reproduce the behavior:

  1. Open Hydra on a Linux distribution
  2. Download any game
  3. After download is finish, click on Install

Note that, what will happend after you click install depends on which distribution/desktop environment you are running. In case of GNOME it should open Archive Manager.

Expected behavior
In case Lutris or Wine are installed, the game installer should open on them. I'm not so sure about what should happen if they are not.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context

  • OS: Debian 12/GNOME
  • Hydra Version: v1.1.1
  • Additional information and context of your problem:
@scrlkx scrlkx added the bug Something isn't working label May 11, 2024
@scrlkx scrlkx changed the title [BUG] Installers are not handled correctly on Linux [BUG] Installers are not handled correctly on Linux (using Lutris or Wine) May 11, 2024
@zamitto
Copy link
Collaborator

zamitto commented May 26, 2024

Ok, let me see if I understood your issue and PR (I'm
I downloaded two games Crow Country and Rabit and Steel.

Crow Country

It has a setup.exe inside the download folder. So with and without your PR, wine opens the setup.exe

Rabit and Steel

It has a .rar file inside the download folder.

  • without your PR (on main branch) it tries to open the directory with the default explorer or something like that (here it actually opened VSCode)
  • with your PR it opens the game directory inside wine, so this is the result:
    image

Is this the expected result when the download does not have a setup.exe?

@scrlkx
Copy link
Author

scrlkx commented May 27, 2024

When I created this issue I was trying to install a game that had an installer file but it was not called setup.exe. I should have mentioned the game's name in the issue, as I can't remember it anymore. I assumed that it was not common for a game to have a setup.exe and that games tend to come with different installer names. I did some tests by installing some random games today and noticed that this is indeed the case.

Just to clarify:

  • The Rabbit and Steel case is a bit harsh because you probably won't be able to do anything in this Wine window. In cases where the game comes in a compressed file, it would be better to just run shell.openPath(gamePath), as it would open the folder in the file manager, allowing the user to install the game themselves. This means my PR makes things worse.
  • In cases where there is an installer, but it's not called setup.exe, opening the folder with Wine would be ideal as it would allow the user to find the installer file and run it directly. This means my PR improves some cases.

In both cases, I think adding a dialog saying "The game installer was not found, please check yourself and add the game to the library later" would be good.

@scrlkx
Copy link
Author

scrlkx commented May 27, 2024

The game I was trying to install was 18 Wheels of Steel: Across America.

@zamitto
Copy link
Collaborator

zamitto commented May 27, 2024

May I suggest something?

  1. If there is a setup.exe inside the gamePath, we call wine ${setupPath} and return
  2. If there is not a setup.exe but there is any other .exe file, we call wine ${gamePath}
  3. If not, we open the directory using shell.openPath(gamePath)

The Windows conditional remains the same as it is in your PR. These checks should happen after that.

What do you think @scrlkx? If you think it is good enough, could you implement this in your PR?

@zamitto
Copy link
Collaborator

zamitto commented May 27, 2024

I think it solves both problems

@scrlkx
Copy link
Author

scrlkx commented May 27, 2024

That's sounds good, I will take another look into it later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants