Octal450 / J-Runner-with-Extras

Source code to the J-Runner with Extras executable. Requires the proper support files, package can be found in README
https://www.realmodscene.com/index.php?/topic/10565-j-runner-with-extras-17559-built-in-timings-bugfixes-and-new-features/
MIT License
248 stars 33 forks source link

Use variables.rootfolder in more places #61

Closed iCrazeiOS closed 1 month ago

iCrazeiOS commented 1 month ago

This PR makes JRunner use variables.rootfolder (default: directory containing main exe) more often when handling files. Without this, certain paths will be localised to the "launch directory" of the program.

I noticed this issue when trying to launch JRunner through the start menu, as it gave me this error: image The program now behaves as I would expect, resolving resources local to the exe.

Octal450 commented 1 month ago

How did you launch via start menu - I do not have that issue.

Variables.rootfolder is used for the location of the working folders - the rest needs to be in reference to the current location of the exe. If you change the root folder away to place your working folders elsewhere, then the application will stop being able to find it's resources.

As of now, I can't merge this as this breaks intended functionality. Your shortcut I believe is not launching the application correctly.

Kind Regards, Josh

iCrazeiOS commented 1 month ago

Wow, thanks for reviewing so quick Josh. When you say

the rest needs to be in reference to the current location of the exe

I believe that would be equivalent to Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) (please do correct me if I'm wrong - Windows is new to me) image So I think that rootfolder would be correct unless someone overrides it? In that case, could the changes I made could be switched to 'GetExecutingAssembly location' directly?

(I don't have a shortcut for the program, it's just that Windows indexed the exe. I believe this starts the program without a "launch path")

Sorry if I'm misunderstanding something here 😅

Octal450 commented 1 month ago

Hi, No prob -

My start menu doesn't do that (indexing my D drive): image

What you're seeing there is the default location. If the user overrides the settings, rootfolder is changed.

Windows starts exe's in a "location" by default. Maybe that's getting screwed up.

Tell you what, I'll implement your fix independently of the rootfolder variable so it never changes, to hopefully mitigate this. I'll do this on the dev branch and in the next release it will be present.

Kind Regards, Josh

iCrazeiOS commented 1 month ago

Sounds great, thank you!

Octal450 commented 1 month ago

Sorry I changed my mind. There are soooo many places where the application does stuff in reference to itself. I would take a long time to update every implementation. If you want to do that, I just created a new variable variables.exefolder. If you go through and update every location to use it, I'll accept the PR - but I think figuring out why Windows is launching your JR improperly might be better.

kind Regards, Josh