Closed Ayanami3rd closed 6 years ago
AppDomain.CurrentDomain.BaseDirectory should always return the directory where the executable file is located. What do you think would be a "proper path variable" to use instead?
I'm neither a VS nor a C# pro, but AppDomain.CurrentDomain.BaseDirectory does not work for me.
What does work is for instance Directory.GetCurrentDirectory() - line 78:
if (!ParseINI(System.IO.File.ReadAllLines(Directory.GetCurrentDirectory() + "/ GBAIntroManager.ini"), gameCode))
I'm using AppDomain.CurrentDomain.BaseDirectory because it will always return the location of the EXE file, regardless of the current working directory (which could differ). What does AppDomain.CurrentDomain.BaseDirectory return for you, and what should it actually return?
Line 20 - characterValues = ReadTableFile(AppDomain.CurrentDomain.BaseDirectory + "/Table.ini");
generates the following error
The file is actually located on my PC in D:\Spiele\Emulatoren\VisualBoy Advance\hack\GBA-Intro Manager\GBAIntroManager\
Interestingly, AppDomain.CurrentDomain.BaseDirectory works in line 78:
if (!ParseINI(System.IO.File.ReadAllLines(AppDomain.CurrentDomain.BaseDirectory + "/ GBAIntroManager.ini"), gameCode))
Edit: Corrected a path,
Okay, that seems to have been a leftover from the output path I had (make sure it didn't create those folders on your C drive). I've pushed a change, try that?
Unfortunately, the path is still not 100% correct. For me, it should be
D:\Spiele\Emulatoren\VisualBoy Advance\hack\GBA-Intro Manager\GBAIntroManager\Table.ini
But the program searches the INI file in
D:\Spiele\Emulatoren\VisualBoy Advance\hack\GBA-Intro Manager\GBAIntroManager\bin\Release\
See attachment.
Well that's because the executable, when you build it, is located in bin/Release. You need to copy the INI files into that folder. This is expected behavior.
Reasons why Visual Studio is not intuitive sometimes.
I resolved the problem by creating symbolic links for the INI files in the \bin\Release folder. Works fine now.
MainWindow.cs: Line 20 and Line 78
Always tries to find INI files in C:\Hacking....
Workaround: Works if I hardcode the path
Solution: Use proper path variables