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

Workdir not saved when it contains the games executable #358

Closed
Lucki opened this issue Mar 27, 2020 · 0 comments
Closed

Workdir not saved when it contains the games executable #358

Lucki opened this issue Mar 27, 2020 · 0 comments

Comments

@Lucki
Copy link
Contributor

Lucki commented Mar 27, 2020

Changing the working directory to any other folder than the folder with the executable in it gets saved but when the folder contains the executable closing the dialog empties the input field.

Verifying with a custom script containing pwd the workdir defaults to the home directory instead of the executable path.

Probably a side issue of this is that the GH_INSTALL_DIR variable passed to custom scripts is empty/missing and any following variables are shifted -1.

Expected behavior

The workdir defaults to the executable path or the input field doesn't get cleared.

Actual behavior

The workdir defaults to the home directory.

Steps to reproduce
  1. Set up a game which needs to be executed in a specific working dir.
  2. Change the working directory to any directory, notice it gets saved when closing and reopening the game property dialog.
  3. Change the working directory back to the path containing the executable, notice the path doesn't get saved. (use case: overlays merge directory)
Version and environment
- GameHub
    Version: 0.15.0-6d20061-makepkg
    Branch:  makepkg
    Commit:  6d200618bb16a16cab849767d7381584f7ff440f
- Environment
    Distro:  Arch Linux
    DE:      GNOME
    GTK:     3.24.14
    Themes:  Numix-ArchBlue | Numix-Circle
Lucki added a commit to Lucki/GameHub that referenced this issue Oct 30, 2021
When the given new `value` equals the iterated `dir` the `work_dir_path` was saved as `$game_dir` and on query tested against `$game_dir/` which resulted in the final path `$game_dir/$game_dir`:

~~~
L326
return get_file(work_dir_path);

L249
if(!path.has_prefix("$game_dir/") && !path.has_prefix("/")) {
	path = "$game_dir/" + path;
}
~~~

Fix tkashkin#358

Former-commit-id: bd43451
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant