Skip to content

Commit 99498e4

Browse files
committed
Also copy Notepad4 DarkTheme.ini to %LOCALAPPDATA%\Notepad4 on first run, PR #1069, issue #834.
1 parent 683b6c5 commit 99498e4

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/Notepad4.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6493,18 +6493,22 @@ void FindIniFile() noexcept {
64936493

64946494
if (status != IniFindStatus::NotFound) {
64956495
WCHAR tchTmp[MAX_PATH];
6496-
LPWSTR pszFile = tchTest;
6496+
LPWSTR pszFile = szIniFile;
6497+
lstrcpy(pszFile, tchTest);
64976498
if (status == IniFindStatus::Program && !finder.portable && finder.appData != nullptr) {
64986499
// copy ini to %LOCALAPPDATA%\Notepad4
64996500
PathCombine(tchTmp, finder.appData, WC_NOTEPAD4);
65006501
SHCreateDirectoryEx(nullptr, tchTmp, nullptr);
6501-
PathAppend(tchTmp, &tchTest[finder.nameIndex]);
6502+
PathAppend(tchTmp, pszFile + finder.nameIndex);
6503+
CopyFile(pszFile, tchTmp, TRUE);
6504+
lstrcpy(pszFile, tchTmp);
6505+
6506+
lstrcpy(PathFindFileName(tchTmp), L"Notepad4 DarkTheme.ini");
6507+
lstrcpy(&tchTest[finder.nameIndex], L"Notepad4 DarkTheme.ini");
65026508
CopyFile(tchTest, tchTmp, TRUE);
65036509
// always use %LOCALAPPDATA% for non-portable installation
6504-
pszFile = tchTmp;
65056510
}
65066511
// check ini redirection
6507-
lstrcpy(szIniFile, pszFile);
65086512
if (GetPrivateProfileString(INI_SECTION_NAME_NOTEPAD4, L"Notepad4.ini", L"", tchTmp, COUNTOF(tchTmp), pszFile)) {
65096513
pszFile = tchTmp;
65106514
if (ExpandEnvironmentStringsEx(tchTmp, tchTest)) {

0 commit comments

Comments
 (0)