Skip to content

Commit

Permalink
Allow using relative paths for ini writing (#1739)
Browse files Browse the repository at this point in the history
For reference:
https://stackoverflow.com/questions/49620394/writeprivateprofilestring-works-in-main-but-not-in-function

"Also, if you read their documentation, you would see that you SHOULD NOT use a relative path for the INI file, or else the file will be relative to the Windows installation folder, not your app folder."

GetFullPathName fixes this issue because the whole purpose of that function is to automatically convert relative paths to absolute.
  • Loading branch information
time-killer-games authored and JoshDreamland committed Jun 2, 2019
1 parent e2d35ce commit 2198ca2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ENIGMAsystem/SHELL/Platforms/Win32/WINDOWSfilemanip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ namespace enigma_user

void ini_open(std::string fname)
{
iniFilename = fname;
char rpath[MAX_PATH];
GetFullPathName(fname.c_str(), MAX_PATH, rpath, NULL);
iniFilename = rpath;
}

void ini_close()
Expand Down

0 comments on commit 2198ca2

Please sign in to comment.