@@ -110,12 +110,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
110110
111111 PathCombine (configDirPath, exeDir, L" config" );
112112
113- /*
114- Convert legacy user-profile.cmd to new name user_profile.cmd
115- */
116113 PathCombine (legacyUserProfilePath, configDirPath, L" user-profile.cmd" );
117- if (PathFileExists (legacyUserProfilePath))
118- {
114+ if (PathFileExists (legacyUserProfilePath)) {
119115 PathCombine (userProfilePath, configDirPath, L" user_profile.cmd" );
120116
121117 char *lPr = (char *)malloc (MAX_PATH);
@@ -128,12 +124,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
128124 rename (lPr, pR);
129125 }
130126
131- /*
132- Convert legacy user-aliases.cmd to new name user_aliases.cmd
133- */
134127 PathCombine (legacyUserAliasesPath, configDirPath, L" user-aliases.cmd" );
135- if (PathFileExists (legacyUserAliasesPath))
136- {
128+ if (PathFileExists (legacyUserAliasesPath)) {
137129 PathCombine (userAliasesPath, configDirPath, L" user_aliases.cmd" );
138130
139131 char *lPr = (char *)malloc (MAX_PATH);
@@ -145,18 +137,13 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
145137 userAliasesPath, (size_t )MAX_PATH);
146138 rename (lPr, pR);
147139 }
148-
149- /*
150- Was -c [path] specified?
151- */
140+
152141 if (wcscmp (userConfigDirPath, L" " ) == 0 )
153142 {
154- // No - It wasn't.
155143 PathCombine (userConfigDirPath, exeDir, L" config" );
156144 }
157145 else
158146 {
159- // Yes - It was.
160147 PathCombine (userBinDirPath, userConfigDirPath, L" bin" );
161148 SHCreateDirectoryEx (0 , userBinDirPath, 0 );
162149
@@ -165,13 +152,9 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
165152
166153 PathCombine (userProfiledDirPath, userConfigDirPath, L" profile.d" );
167154 SHCreateDirectoryEx (0 , userProfiledDirPath, 0 );
168-
169- /*
170- Convert legacy user-profile.cmd to new name user_profile.cmd
171- */
155+
172156 PathCombine (legacyUserProfilePath, userConfigDirPath, L" user-profile.cmd" );
173- if (PathFileExists (legacyUserProfilePath))
174- {
157+ if (PathFileExists (legacyUserProfilePath)) {
175158 PathCombine (userProfilePath, userConfigDirPath, L" user_profile.cmd" );
176159
177160 char *lPr = (char *)malloc (MAX_PATH);
@@ -184,12 +167,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
184167 rename (lPr, pR);
185168 }
186169
187- /*
188- Convert legacy user-aliases.cmd to new name user_aliases.cmd
189- */
190170 PathCombine (legacyUserAliasesPath, userConfigDirPath, L" user-aliases.cmd" );
191- if (PathFileExists (legacyUserAliasesPath))
192- {
171+ if (PathFileExists (legacyUserAliasesPath)) {
193172 PathCombine (userAliasesPath, userConfigDirPath, L" user_aliases.cmd" );
194173
195174 char *lPr = (char *)malloc (MAX_PATH);
@@ -207,19 +186,15 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
207186 PathCombine (cfgPath, exeDir, L" vendor\\ conemu-maximus5\\ ConEmu.xml" );
208187
209188 // Set path to Cmder default ConEmu config file
210- PathCombine (defaultCfgPath, exeDir, L" config\\ vendor \\ ConEmu.xml.default " );
189+ PathCombine (defaultCfgPath, exeDir, L" config\\ ConEmu.xml" );
211190
212191 // Check for machine-specific then user config source file.
213192 PathCombine (cpuCfgPath, userConfigDirPath, L" ConEmu-%COMPUTERNAME%.xml" );
214193 ExpandEnvironmentStrings (cpuCfgPath, cpuCfgPath, sizeof (cpuCfgPath) / sizeof (cpuCfgPath[0 ]));
215194
216- // Set path to Cmder user ConEmu config file
217195 PathCombine (userCfgPath, userConfigDirPath, L" user-ConEmu.xml" );
218-
219- if (PathFileExists (cpuCfgPath)) // If machine-specific ConEmu config file exists - use it.
220- {
221- if (PathFileExists (cfgPath)) // If vendor ConEmu config file exists - back it up to config/ConEmu-%COMPUTERNAME%.xml.
222- {
196+ if (PathFileExists (cpuCfgPath)) {
197+ if (PathFileExists (cfgPath)) {
223198 if (!CopyFile (cfgPath, cpuCfgPath, FALSE ))
224199 {
225200 MessageBox (NULL ,
@@ -229,7 +204,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
229204 exit (1 );
230205 }
231206 }
232- else // If vendor ConEmu config file does not exists - Copy machine-specific config/ConEmu-%COMPUTERNAME%.xml to vendor ConEmu.xml file
207+ else
233208 {
234209 if (!CopyFile (cpuCfgPath, cfgPath, FALSE ))
235210 {
@@ -241,10 +216,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
241216 }
242217 }
243218 }
244- else if (PathFileExists (userCfgPath)) // If config/user_conemu.xml exists use it.
245- {
246- if (PathFileExists (cfgPath)) // If vendor conemu.xml exits back it up to config/user_conemu.xml.
247- {
219+ else if (PathFileExists (userCfgPath)) {
220+ if (PathFileExists (cfgPath)) {
248221 if (!CopyFile (cfgPath, userCfgPath, FALSE ))
249222 {
250223 MessageBox (NULL ,
@@ -254,7 +227,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
254227 exit (1 );
255228 }
256229 }
257- else // If vendor conemu.xml does not exist copy user_conemu.xml to vendor conemu.xml
230+ else
258231 {
259232 if (!CopyFile (userCfgPath, cfgPath, FALSE ))
260233 {
@@ -266,8 +239,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
266239 }
267240 }
268241 }
269- else if (PathFileExists (cfgPath)) // If vendor conemu.xml exists copy config/user_conemu.xml
270- {
242+ else if (PathFileExists (cfgPath)) {
271243 if (!CopyFile (cfgPath, userCfgPath, FALSE ))
272244 {
273245 MessageBox (NULL ,
@@ -277,8 +249,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
277249 exit (1 );
278250 }
279251 }
280- else // No previous conemu.xml config exists use the default.
281- {
252+ else {
282253 if (!CopyFile (defaultCfgPath, cfgPath, FALSE ))
283254 {
284255 MessageBox (NULL ,
@@ -291,34 +262,28 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
291262
292263 SYSTEM_INFO sysInfo;
293264 GetNativeSystemInfo (&sysInfo);
294- if (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
295- {
265+ if (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) {
296266 PathCombine (conEmuPath, exeDir, L" vendor\\ conemu-maximus5\\ ConEmu64.exe" );
297267 }
298- else
299- {
268+ else {
300269 PathCombine (conEmuPath, exeDir, L" vendor\\ conemu-maximus5\\ ConEmu.exe" );
301270 }
302271
303272 if (is_single_mode)
304273 {
305- if (!streqi (cmderTask.c_str (), L" " ))
306- {
274+ if (!streqi (cmderTask.c_str (), L" " )) {
307275 swprintf_s (args, L" %s /single /Icon \" %s\" /Title Cmder /dir \" %s\" /run {%s}" , args, icoPath, cmderStart.c_str (), cmderTask.c_str ());
308276 }
309- else
310- {
277+ else {
311278 swprintf_s (args, L" %s /single /Icon \" %s\" /Title Cmder /dir \" %s\" " , args, icoPath, cmderStart.c_str ());
312279 }
313280 }
314281 else
315282 {
316- if (!streqi (cmderTask.c_str (), L" " ))
317- {
283+ if (!streqi (cmderTask.c_str (), L" " )) {
318284 swprintf_s (args, L" /Icon \" %s\" /Title Cmder /dir \" %s\" /run {%s}" , icoPath, cmderStart.c_str (), cmderTask.c_str ());
319285 }
320- else
321- {
286+ else {
322287 swprintf_s (args, L" %s /Icon \" %s\" /Title Cmder /dir \" %s\" " , args, icoPath, cmderStart.c_str ());
323288 }
324289 }
@@ -470,8 +435,7 @@ cmderOptions GetOption()
470435
471436 cmderOptions.cmderCfgRoot = cmderCfgRoot;
472437
473- if (szArgList[i + 1 ] != NULL && szArgList[i + 1 ][0 ] != ' /' )
474- {
438+ if (szArgList[i + 1 ] != NULL && szArgList[i + 1 ][0 ] != ' /' ) {
475439 cmderOptions.cmderCfgRoot = szArgList[i + 1 ];
476440 i++;
477441 }
@@ -489,8 +453,7 @@ cmderOptions GetOption()
489453 cmderOptions.cmderStart = szArgList[i + 1 ];
490454 i++;
491455 }
492- else
493- {
456+ else {
494457 MessageBox (NULL , szArgList[i + 1 ], L" /START - Folder does not exist!" , MB_OK);
495458 }
496459 }
@@ -542,13 +505,11 @@ cmderOptions GetOption()
542505 cmderOptions.cmderStart = szArgList[i];
543506 i++;
544507 }
545- else
546- {
508+ else {
547509 MessageBox (NULL , szArgList[i], L" Folder does not exist!" , MB_OK);
548510 }
549511 }
550- else
551- {
512+ else {
552513 MessageBox (NULL , L" Unrecognized parameter.\n\n Valid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n or\n\n /register [USER | ALL]\n\n or\n\n /unregister [USER | ALL]\n " , MB_TITLE, MB_OK);
553514 cmderOptions.error = true ;
554515 }
@@ -570,8 +531,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
570531
571532 cmderOptions cmderOptions = GetOption ();
572533
573- if (cmderOptions.registerApp == true )
574- {
534+ if (cmderOptions.registerApp == true ) {
575535 RegisterShellMenu (cmderOptions.cmderRegScope , SHELL_MENU_REGISTRY_PATH_BACKGROUND);
576536 RegisterShellMenu (cmderOptions.cmderRegScope , SHELL_MENU_REGISTRY_PATH_LISTITEM);
577537 }
0 commit comments