hydra
hydra copied to clipboard
[BUG] Installers are not handled correctly on Linux (using Lutris or Wine)
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:
- Open Hydra on a Linux distribution
- Download any game
- 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:
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:
Is this the expected result when the download does not have a setup.exe?
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 not 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.
The game I was trying to install was 18 Wheels of Steel: Across America.
May I suggest something?
- If there is a
setup.exe
inside thegamePath
, we callwine ${setupPath}
and return - If there is not a
setup.exe
but there is any other.exe
file, we callwine ${gamePath}
- 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?
I think it solves both problems
That's sounds good, I will take another look into it later.