diff --git a/Docs/src/var.but b/Docs/src/var.but index 0efbb020..7adc3ec4 100644 --- a/Docs/src/var.but +++ b/Docs/src/var.but @@ -75,6 +75,10 @@ The Windows desktop directory (usually \c{C:\\Windows\\Desktop} but detected at The directory containing the installer executable (technically you can modify this variable, but it is probably not a good idea). +\e{$EXEFILE} + +The base name of the installer executable. + \e{$EXEPATH} The full path of the installer executable. diff --git a/Source/build.cpp b/Source/build.cpp index 119ad33f..216edf25 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -302,9 +302,10 @@ CEXEBuild::CEXEBuild() : m_UserVarNames.add("TEMP",-1); // 25 m_UserVarNames.add("PLUGINSDIR",-1); // 26 m_UserVarNames.add("EXEPATH",-1); // 27 - m_UserVarNames.add("HWNDPARENT",-1); // 28 - m_UserVarNames.add("_CLICK",-1); // 29 - m_UserVarNames.add("_OUTDIR",1); // 30 + m_UserVarNames.add("EXEFILE",-1); // 28 + m_UserVarNames.add("HWNDPARENT",-1); // 29 + m_UserVarNames.add("_CLICK",-1); // 30 + m_UserVarNames.add("_OUTDIR",1); // 31 m_iBaseVarsNum = m_UserVarNames.getnum(); diff --git a/Source/exehead/fileform.c b/Source/exehead/fileform.c index 0fbd1ce8..e38584b3 100644 --- a/Source/exehead/fileform.c +++ b/Source/exehead/fileform.c @@ -138,9 +138,8 @@ const char * NSISCALL loadHeaders(int cl_flags) return _LANG_CANTOPENSELF; } - // make state_exe_directory point to dir. mystrcpy(state_exe_directory, state_exe_path); - trimslashtoend(state_exe_directory); + mystrcpy(state_exe_file, trimslashtoend(state_exe_directory)); left = m_length = GetFileSize(db_hFile,NULL); while (left > 0) diff --git a/Source/exehead/state.h b/Source/exehead/state.h index 52583eb0..8aa50202 100644 --- a/Source/exehead/state.h +++ b/Source/exehead/state.h @@ -28,7 +28,8 @@ extern NSIS_STRING g_usrvars[1]; # define state_plugins_dir g_usrvars[26] #endif #define state_exe_path g_usrvars[27] -#define state_click_next g_usrvars[29] +#define state_exe_file g_usrvars[28] +#define state_click_next g_usrvars[30] extern char g_caption[NSIS_MAX_STRLEN*2]; #ifdef NSIS_CONFIG_VISIBLE_SUPPORT diff --git a/Source/exehead/util.c b/Source/exehead/util.c index 473caa92..dbf9ec5d 100644 --- a/Source/exehead/util.c +++ b/Source/exehead/util.c @@ -260,7 +260,7 @@ char * NSISCALL findchar(char *str, char c) return str; } -void NSISCALL trimslashtoend(char *buf) +char * NSISCALL trimslashtoend(char *buf) { char *p = buf + mystrlen(buf); do @@ -271,6 +271,8 @@ void NSISCALL trimslashtoend(char *buf) } while (p > buf); *p = 0; + + return p + 1; } int NSISCALL validpathspec(char *ubuf) @@ -675,7 +677,7 @@ char * NSISCALL GetNSISString(char *outbuf, int strtab) } else if (nVarIdx == NS_VAR_CODE) { - if (nData == 28) // HWNDPARENT + if (nData == 29) // $HWNDPARENT myitoa(out, (unsigned int) g_hwnd); else mystrcpy(out, g_usrvars[nData]); diff --git a/Source/exehead/util.h b/Source/exehead/util.h index 5ca15ed4..366ad6c1 100644 --- a/Source/exehead/util.h +++ b/Source/exehead/util.h @@ -86,7 +86,7 @@ char * NSISCALL addtrailingslash(char *str); //char NSISCALL lastchar(const char *str); #define lastchar(str) *CharPrev(str,str+mystrlen(str)) char * NSISCALL findchar(char *str, char c); -void NSISCALL trimslashtoend(char *buf); +char * NSISCALL trimslashtoend(char *buf); char * NSISCALL skip_root(char *path); int NSISCALL is_valid_instpath(char *s); void NSISCALL validate_filename(char *fn);