Skip to content

Commit ffa37d4

Browse files
committed
sync fix launcher overwrite
2 parents f38e0b3 + f4f6255 commit ffa37d4

File tree

2 files changed

+52
-50
lines changed

2 files changed

+52
-50
lines changed

launcher/src/CmderLauncher.cpp

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -300,57 +300,59 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
300300
PathCombine(userCfgPath, userConfigDirPath, L"user-ConEmu.xml");
301301
}
302302

303-
if (wcscmp(cpuCfgPath, L"") == 0 && (PathFileExists(cpuCfgPath) || use_user_cfg == false)) // config/ConEmu-%COMPUTERNAME%.xml file exists or /m was specified on command line, use machine specific config.
303+
if ( PathFileExists(cpuCfgPath) || use_user_cfg == false ) // config/[cpu specific terminal emulator config] file exists or /m was specified on command line, use machine specific config.
304304
{
305305
if (cfgRoot.length() == 0) // '/c [path]' was NOT specified
306306
{
307-
if (!CopyFile(cfgPath, cpuCfgPath, FALSE))
307+
if (PathFileExists(cfgPath)) // [terminal emulator config] file exists, copy [terminal emulator config] to config/user_[terminal emulator config] file to backup any settings changes from previous sessions.
308308
{
309-
if (PathFileExists(windowsTerminalDir)) {
310-
MessageBox(NULL,
311-
(GetLastError() == ERROR_ACCESS_DENIED)
312-
? L"Failed to copy vendor/windows-terminal/settings/settings.json file to config/windows_terminal_%COMPUTERNAME%_settings.json! Access Denied."
313-
: L"Failed to copy vendor/windows-terminal/settings/settings.json file to config/windows_teerminal_%COMPUTERNAME%_settigns.json!", MB_TITLE, MB_ICONSTOP);
314-
exit(1);
315-
}
316-
else if (PathFileExists(conEmuDir))
309+
if (!CopyFile(cfgPath, cpuCfgPath, FALSE))
317310
{
318-
MessageBox(NULL,
319-
(GetLastError() == ERROR_ACCESS_DENIED)
320-
? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml! Access Denied."
321-
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml!", MB_TITLE, MB_ICONSTOP);
322-
exit(1);
311+
if (PathFileExists(windowsTerminalDir)) {
312+
MessageBox(NULL,
313+
(GetLastError() == ERROR_ACCESS_DENIED)
314+
? L"Failed to copy vendor/windows-terminal/settings/settings.json file to config/windows_terminal_%COMPUTERNAME%_settings.json! Access Denied."
315+
: L"Failed to copy vendor/windows-terminal/settings/settings.json file to config/windows_teerminal_%COMPUTERNAME%_settigns.json!", MB_TITLE, MB_ICONSTOP);
316+
exit(1);
317+
}
318+
else if (PathFileExists(conEmuDir))
319+
{
320+
MessageBox(NULL,
321+
(GetLastError() == ERROR_ACCESS_DENIED)
322+
? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml! Access Denied."
323+
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml!", MB_TITLE, MB_ICONSTOP);
324+
exit(1);
325+
}
323326
}
324327
}
325-
}
326-
else // vendor/conemu-maximus5/ConEmu.xml config file does not exist, copy config/ConEmu-%COMPUTERNAME%.xml to vendor/conemu-maximus5/ConEmu.xml file
327-
{
328-
if (!CopyFile(cpuCfgPath, cfgPath, FALSE))
328+
else // [terminal emulator config] file does not exist, copy config/[cpu specific terminal emulator config] file to [terminal emulator config] file
329329
{
330-
if (PathFileExists(windowsTerminalDir))
330+
if (!CopyFile(cpuCfgPath, cfgPath, FALSE))
331331
{
332-
MessageBox(NULL,
333-
(GetLastError() == ERROR_ACCESS_DENIED)
334-
? L"Failed to copy config/windows_terminal_%COMPUTERNAME%_settings.json file to vendor/windows-terminal/settings/settings.json! Access Denied."
335-
: L"Failed to copy config/windows_terminal_%COMPUTERNAME%_settings.json file to vendor/windows-terminal/settings/settings.json!", MB_TITLE, MB_ICONSTOP);
336-
exit(1);
337-
}
338-
else if (PathFileExists(conEmuDir))
339-
{
340-
MessageBox(NULL,
341-
(GetLastError() == ERROR_ACCESS_DENIED)
342-
? L"Failed to copy config/ConEmu-%COMPUTERNAME%.xml file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
343-
: L"Failed to copy config/ConEmu-%COMPUTERNAME%.xml file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
344-
exit(1);
332+
if (PathFileExists(windowsTerminalDir)) {
333+
MessageBox(NULL,
334+
(GetLastError() == ERROR_ACCESS_DENIED)
335+
? L"Failed to copy config/windows_terminal_%COMPUTERNAME%_settings.json file to vendor/windows-terminal/settings/settings.json! Access Denied."
336+
: L"Failed to copy config/windows_terminal_%COMPUTERNAME%_settings.json file to vendor/windows-terminal/settings/settings.json!", MB_TITLE, MB_ICONSTOP);
337+
exit(1);
338+
}
339+
else if (PathFileExists(conEmuDir))
340+
{
341+
MessageBox(NULL,
342+
(GetLastError() == ERROR_ACCESS_DENIED)
343+
? L"Failed to copy config/ConEmu-%COMPUTERNAME%.xml file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
344+
: L"Failed to copy config/ConEmu-%COMPUTERNAME%.xml file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
345+
exit(1);
346+
}
345347
}
346348
}
347349
}
348350
}
349-
else if (wcscmp(userCfgPath, L"") == 0 && PathFileExists(userCfgPath)) // config/user_conemu.xml exists, use it.
351+
else if (PathFileExists(userCfgPath)) // config/user[terminal emulator config] file exists, use it.
350352
{
351353
if (cfgRoot.length() == 0) // '/c [path]' was NOT specified
352354
{
353-
if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml exists, copy vendor/conemu-maximus5/ConEmu.xml to config/user_conemu.xml.
355+
if (PathFileExists(cfgPath)) // [terminal emulator config] file exists, copy [terminal emulator config] to config/user_[terminal emulator config] file to backup any settings changes from previous sessions.
354356
{
355357
if (!CopyFile(cfgPath, userCfgPath, FALSE))
356358
{
@@ -372,7 +374,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
372374
}
373375
}
374376
}
375-
else // vendor/conemu-maximus5/ConEmu.xml does not exist, copy config/user-conemu.xml to vendor/conemu-maximus5/ConEmu.xml
377+
else // [terminal emulator config] file does not exist, copy config/user_[terminal emulator config] file to [terminal emulator config] file
376378
{
377379
if (!CopyFile(userCfgPath, cfgPath, FALSE))
378380
{
@@ -395,13 +397,13 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
395397
}
396398
}
397399
}
398-
else if (!PathFileExists(windowsTerminalDir)) { // '/c [path]' was specified, don't copy anything and use existing user_conemu.xml to start comemu.
400+
else if (!PathFileExists(windowsTerminalDir)) { // '/c [path]' was specified, don't copy anything and use existing user_[terminal emulator config] file.
399401
PathCombine(userConEmuCfgPath, userConfigDirPath, L"user-ConEmu.xml");
400402
}
401403
}
402404
else if (cfgRoot.length() == 0) // '/c [path]' was NOT specified
403405
{
404-
if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml exists, copy vendor/conemu-maximus5/ConEmu.xml to config/user_conemu.xml
406+
if (PathFileExists(cfgPath)) // [terminal emulator config] file exists, copy [terminal emulator config] file to config/user_[terminal emulator config] file.
405407
{
406408
if (!CopyFile(cfgPath, userCfgPath, FALSE))
407409
{
@@ -422,7 +424,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
422424
exit(1);
423425
}
424426
}
425-
else // vendor/ConEmu.xml.default config exists, copy Cmder vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml.
427+
else // vendor/[terminal emulator config].default config exists, copy Cmder vendor/[terminal emulator config].default file to [terminal emulator config] file.
426428
{
427429
if (!CopyFile(defaultCfgPath, cfgPath, FALSE))
428430
{
@@ -449,12 +451,12 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
449451
{
450452
MessageBox(NULL,
451453
(GetLastError() == ERROR_ACCESS_DENIED)
452-
? L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
454+
? L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
453455
: L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
454456
exit(1);
455457
}
456458
}
457-
else if (wcscmp(cfgPath, L"") == 0 && PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml exists, copy vendor/conemu-maximus5/ConEmu.xml to config/user_conemu.xml
459+
else if (PathFileExists(cfgPath)) // This is a first time Cmder.exe run and [terminal emulator config] file exists, copy [terminal emulator config] file to config/user_[terminal emulator config] file.
458460
{
459461
if (!CopyFile(cfgPath, userCfgPath, FALSE))
460462
{
@@ -478,7 +480,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
478480

479481
PathCombine(userConEmuCfgPath, userConfigDirPath, L"user-ConEmu.xml");
480482
}
481-
else if (wcscmp(defaultCfgPath, L"") == 0) // '/c [path]' was specified and 'vendor/ConEmu.xml.default' config exists, copy Cmder 'vendor/ConEmu.xml.default' file to '[user specified path]/config/user_ConEmu.xml'.
483+
else if (wcscmp(defaultCfgPath, L"") == 0) // '/c [path]' was specified and 'vendor/[terminal emulator config].default' config exists, copy Cmder 'vendor/[terminal emulator config].default' file to '[user specified path]/config/user_[terminal emulator config]'.
482484
{
483485
if (!CopyFile(defaultCfgPath, userCfgPath, FALSE))
484486
{

vendor/sources.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
[
22
{
33
"name": "windows-terminal",
4-
"version": "1.17.11461.0",
5-
"url": "https://github.com/microsoft/terminal/releases/download/v1.17.11461.0/Microsoft.WindowsTerminal_1.17.11461.0_x64.zip"
4+
"version": "1.20.11271.0",
5+
"url": "https://github.com/microsoft/terminal/releases/download/v1.20.11271.0/Microsoft.WindowsTerminal_1.20.11271.0_x64.zip"
66
},
77
{
88
"name": "git-for-windows",
9-
"version": "2.42.0.windows.1",
10-
"url": "https://github.com/git-for-windows/git/releases/download/v2.42.0.windows.1/PortableGit-2.42.0-64-bit.7z.exe"
9+
"version": "2.45.1.windows.1",
10+
"url": "https://github.com/git-for-windows/git/releases/download/v2.45.1.windows.1/PortableGit-2.45.1-64-bit.7z.exe"
1111
},
1212
{
1313
"name": "clink",
14-
"version": "1.5.12",
15-
"url": "https://github.com/chrisant996/clink/releases/download/v1.5.12/clink.1.5.12.c7156f.zip"
14+
"version": "1.6.14",
15+
"url": "https://github.com/chrisant996/clink/releases/download/v1.6.14/clink.1.6.14.93b83f.zip"
1616
},
1717
{
1818
"name": "conemu-maximus5",
@@ -21,7 +21,7 @@
2121
},
2222
{
2323
"name": "clink-completions",
24-
"version": "0.4.11",
25-
"url": "https://github.com/vladimir-kotikov/clink-completions/archive/v0.4.11.zip"
24+
"version": "0.5.2",
25+
"url": "https://github.com/vladimir-kotikov/clink-completions/archive/v0.5.2.zip"
2626
}
2727
]

0 commit comments

Comments
 (0)