Skip to content

Commit

Permalink
Add supported to detect process dir as config dir automatically.
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackINT3 committed Oct 14, 2020
1 parent 9d355bc commit ed65673
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/OpenArk/common/app/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,16 @@ inline QString AppBuildTime()

inline std::wstring AppConfigDir()
{
auto &&dir = UNONE::OsEnvironmentW(L"%AppData%") + L"\\OpenArk";
static std::wstring dir;
if (!dir.empty()) return dir;

auto &&curdir = UNONE::PsGetProcessDirW();
auto &&cfg = curdir + L"\\openark.ini";
if (UNONE::FsIsExistedW(cfg)) {
dir = std::move(curdir);
return dir;
}
dir = UNONE::OsEnvironmentW(L"%AppData%") + L"\\OpenArk";
return dir;
}

Expand Down

0 comments on commit ed65673

Please sign in to comment.