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

fix access of files relative to the program directory #106

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

TomaSajt
Copy link

@TomaSajt TomaSajt commented Jan 7, 2024

I had some issues with the res directory not being found correctly when my working directory was somewhere else than the project.

For example, doing dotnet run --project Fushigi/Fushigi.csproj from the root of the repository when you don't have an imgui.ini file in your current directory will crash the app.

If you have -c Release set, it will silently crash

The problem is with paths being relative to the working directory instead of the app directory (where the res directory and the .dll files are)

I saw that there was a line in the code which prepended AppDomain.CurrentDomain.BaseDirectory before "res"
and there was another line which prepended AppContext.BaseDirectory
These both solved the problem

According to this, there's no difference between them
https://learn.microsoft.com/en-us/dotnet/api/system.appcontext.basedirectory

Sadly I can't really test it out, as I couldn't properly setup my game files...
I'd be happy if someone could test if this works as expected

@TomaSajt TomaSajt reopened this Jan 7, 2024
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

Successfully merging this pull request may close these issues.

1 participant