Skip to content

Commit

Permalink
Accept additional suffixes for console launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadelessFox committed Oct 18, 2024
1 parent d5d5513 commit 7e684f2
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,21 @@ _TCHAR* getIniFile(_TCHAR* program, int consoleLauncher){
extension = config_file + _tcslen(config_file);
}
_tcscpy(extension, _T_ECLIPSE(".ini"));
if(consoleLauncher){
struct _stat stats;
if(consoleLauncher && _tstat(config_file, &stats) != 0){
/* We are the console version, if the ini file does not exist, try
* removing the 'c' from the end of the program name */
struct _stat stats;
if (_tstat( config_file, &stats ) != 0 && *(extension - 1) == _T('c')) {
_tcscpy(extension - 1, extension);
* removing the suffix from the end of the program name */
static const _TCHAR* consoleLauncherSuffixes[] = {
_T_ECLIPSE("c"), // eclipsec.exe
_T_ECLIPSE("-cli"), // eclipse-cli.exe
NULL
};
for (const _TCHAR** suffix = consoleLauncherSuffixes; *suffix; suffix++) {
size_t suffixLen = _tcslen(*suffix);
if (_tcsncmp(extension - suffixLen, *suffix, suffixLen) == 0) {
_tcscpy(extension - suffixLen, extension);
break;
}
}
}
}
Expand Down

0 comments on commit 7e684f2

Please sign in to comment.