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

settings.json/steam_appid.txt/etc placed in working directory instead of the application folder #223

Closed
antiz opened this issue Jun 20, 2020 · 1 comment
Labels
Status: Implemented Indicates that the issue has been handled but may not have been merged. Type: Enhancement
Milestone

Comments

@antiz
Copy link

antiz commented Jun 20, 2020

Hi!

Expected Behavior

The instance-specific configuration (everything except GlobalSettings) is tied to that copy/extracted directory of AML without being affected by how AML is started.

Current Behavior

AML searches for its configuration in the current working dir of the calling environment.

Possible Solution

During startup, set the working dir to the directory containing the executable: XCOM2 Launcher.exe

(Or use appropriate paths when opening settings.json/etc, but I reckon that is more effort.)

Steps to Reproduce

  1. cd C:\
  2. .\path\to\XCOM2 Launcher.exe

Details / Context

Some application launchers behave differently than Windows Shell/Explorer.

For example: PowerToys Run uses its own installation directory as the working dir for applications it starts (which I admit is questionable). As a result, AML tries to write to C:\Program Files\PowerToys\steam_appid.txt, which is neither sensible, nor likely to succeed, unless elevated.

Possible Implementation

Directory.SetCurrentDirectory(Path.GetDirectoryName(Application.ExecutablePath)); on startup

I'm not too knowledgeable on C#/WinForms so there might be a more fitting API to use, but this does do the trick; tested locally.

Behaviour when double-clicking the executable or using Run (win+r) is unchanged, as this change simply forces a behaviour that was already present in those scenarios. Behaviour when using a Shortcut to launch AML is unchanged as well, unless the user manually changed the Start in attribute of the shortcut.

All this is under the assumption that keeping the settings in the application dir is indeed the intended behaviour. Please correct me if I'm wrong on this.

I can do a pull request for this, but given that it's a one-liner, it might be easier for a contributor to make the change directly.

Greetings,
antiz

@RevZero RevZero added the Status: Review Verify bug or check feasibility of a new feature. label Jun 20, 2020
@RevZero RevZero closed this as completed Jun 20, 2020
@RevZero RevZero reopened this Jun 20, 2020
@RevZero
Copy link
Member

RevZero commented Jun 20, 2020

Thanks for the detailed report. I will probably have time to verify and accept this tomorrow.

@RevZero RevZero added Status: Accepted Confirmed bug or useful feature that should be worked on. Type: Enhancement and removed Status: Review Verify bug or check feasibility of a new feature. labels Sep 9, 2021
@RevZero RevZero added this to the v1.5 milestone Sep 9, 2021
@RevZero RevZero added Status: Implemented Indicates that the issue has been handled but may not have been merged. and removed Status: Accepted Confirmed bug or useful feature that should be worked on. labels Sep 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Implemented Indicates that the issue has been handled but may not have been merged. Type: Enhancement
Projects
None yet
Development

No branches or pull requests

2 participants