diff --git a/Source/exehead/Ui.c b/Source/exehead/Ui.c index a914912a..882853e3 100644 --- a/Source/exehead/Ui.c +++ b/Source/exehead/Ui.c @@ -145,8 +145,7 @@ static BOOL NSISCALL _HandleStaticBkColor(UINT uMsg, WPARAM wParam, LPARAM lPara #ifdef NSIS_CONFIG_LOG void NSISCALL build_g_logfile() { - addtrailingslash(mystrcpy(g_log_file,state_install_directory)); - lstrcat(g_log_file,"install.log"); + lstrcat(addtrailingslash(mystrcpy(g_log_file,state_install_directory)),"install.log"); } #endif @@ -820,8 +819,7 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar p=name+mystrlen(name)-mystrlen(post_str); if (p <= name || *CharPrev(name,p)!='\\' || lstrcmpi(p,post_str)) { - addtrailingslash(name); - lstrcat(name,post_str); + lstrcat(addtrailingslash(name),post_str); } } diff --git a/Source/exehead/exec.c b/Source/exehead/exec.c index b35f72de..901dce89 100644 --- a/Source/exehead/exec.c +++ b/Source/exehead/exec.c @@ -357,15 +357,14 @@ static int NSISCALL ExecuteEntry(entry *entry_) HANDLE hOut; int ret; char *buf3=process_string_fromparm_tobuf(0x31); - #define overwriteflag parm0 - addtrailingslash(mystrcpy(buf0,state_output_directory)); + #define overwriteflag parm0 log_printf3("File: overwriteflag=%d, name=\"%s\"",overwriteflag,buf3); if (validpathspec(buf3)) { mystrcpy(buf0,buf3); } - else lstrcat(buf0,buf3); + else lstrcat(addtrailingslash(mystrcpy(buf0,state_output_directory)),buf3); _tryagain: if (!overwriteflag) { @@ -1341,8 +1340,7 @@ static int NSISCALL ExecuteEntry(entry *entry_) } else { - addtrailingslash(mystrcpy(buf1,state_install_directory)); - lstrcat(buf1,buf0); + lstrcat(addtrailingslash(mystrcpy(buf1,state_install_directory)),buf0); } diff --git a/Source/exehead/util.c b/Source/exehead/util.c index 62e1e56f..70b39966 100644 --- a/Source/exehead/util.c +++ b/Source/exehead/util.c @@ -87,9 +87,10 @@ void NSISCALL doRMDir(char *buf, int recurse) } #endif//NSIS_SUPPORT_RMDIR -void NSISCALL addtrailingslash(char *str) +char *NSISCALL addtrailingslash(char *str) { if (lastchar(str)!='\\') lstrcat(str,"\\"); + return str; } char NSISCALL lastchar(const char *str) diff --git a/Source/exehead/util.h b/Source/exehead/util.h index 87fd054c..8f78abf0 100644 --- a/Source/exehead/util.h +++ b/Source/exehead/util.h @@ -47,7 +47,7 @@ void NSISCALL doRMDir(char *buf, int recurse); HANDLE NSISCALL myOpenFile(const char *fn, DWORD da, DWORD cd); int NSISCALL CreateShortCut(HWND hwnd, LPCSTR pszShortcutFile, LPCSTR pszIconFile, int iconindex, LPCSTR pszExe, LPCSTR pszArg, LPCSTR workingdir, int showmode, int hotkey); int NSISCALL validpathspec(char *ubuf); -void NSISCALL addtrailingslash(char *str); +char * NSISCALL addtrailingslash(char *str); char NSISCALL lastchar(const char *str); void NSISCALL trimslashtoend(char *buf); char * NSISCALL scanendslash(const char *str);