From 0ef9426b45de21240ee9edb17cf9a606809931a8 Mon Sep 17 00:00:00 2001 From: kichik Date: Thu, 19 Apr 2007 21:38:11 +0000 Subject: [PATCH] added $EXEPATH git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5105 212acab6-be3b-0410-9dea-997c60f758d6 --- Docs/src/var.but | 6 +++++- Source/build.cpp | 1 + Source/exehead/fileform.c | 8 ++++---- Source/exehead/state.h | 1 + 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Docs/src/var.but b/Docs/src/var.but index 24c3c25c..0efbb020 100644 --- a/Docs/src/var.but +++ b/Docs/src/var.but @@ -73,7 +73,11 @@ The Windows desktop directory (usually \c{C:\\Windows\\Desktop} but detected at \e{$EXEDIR} -The location of the installer executable (technically you can modify this variable, but it is probably not a good idea). +The directory containing the installer executable (technically you can modify this variable, but it is probably not a good idea). + +\e{$EXEPATH} + +The full path of the installer executable. \e{$\{NSISDIR\}} diff --git a/Source/build.cpp b/Source/build.cpp index b89e7b93..ea66b474 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -304,6 +304,7 @@ CEXEBuild::CEXEBuild() : m_UserVarNames.add("HWNDPARENT",-1); // 27 m_UserVarNames.add("_CLICK",-1); // 28 m_UserVarNames.add("_OUTDIR",1); // 29 + m_UserVarNames.add("EXEPATH",-1); // 30 m_iBaseVarsNum = m_UserVarNames.getnum(); diff --git a/Source/exehead/fileform.c b/Source/exehead/fileform.c index 23523f2a..0fbd1ce8 100644 --- a/Source/exehead/fileform.c +++ b/Source/exehead/fileform.c @@ -130,16 +130,16 @@ const char * NSISCALL loadHeaders(int cl_flags) HANDLE db_hFile; - GetModuleFileName(NULL, state_exe_directory, NSIS_MAX_STRLEN); + GetModuleFileName(NULL, state_exe_path, NSIS_MAX_STRLEN); - g_db_hFile = db_hFile = myOpenFile(state_exe_directory, GENERIC_READ, OPEN_EXISTING); + g_db_hFile = db_hFile = myOpenFile(state_exe_path, GENERIC_READ, OPEN_EXISTING); if (db_hFile == INVALID_HANDLE_VALUE) { return _LANG_CANTOPENSELF; } - // make state_exe_directory point to dir, not full exe. - + // make state_exe_directory point to dir. + mystrcpy(state_exe_directory, state_exe_path); trimslashtoend(state_exe_directory); left = m_length = GetFileSize(db_hFile,NULL); diff --git a/Source/exehead/state.h b/Source/exehead/state.h index a71e6ec0..f15fffab 100644 --- a/Source/exehead/state.h +++ b/Source/exehead/state.h @@ -28,6 +28,7 @@ extern NSIS_STRING g_usrvars[1]; # define state_plugins_dir g_usrvars[26] #endif #define state_click_next g_usrvars[28] +#define state_exe_path g_usrvars[30] extern char g_caption[NSIS_MAX_STRLEN*2]; #ifdef NSIS_CONFIG_VISIBLE_SUPPORT