fixed bug #1075363 - nsisconf.nsh not included when using makensisw
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3798 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
3df8dedd0c
commit
0e74cc0391
4 changed files with 22 additions and 29 deletions
|
@ -475,25 +475,6 @@ definedlist.add("NSIS_SUPPORT_LANG_IN_STRINGS");
|
||||||
m_ShellConstants.add("CDBURN_AREA", CSIDL_CDBURN_AREA, CSIDL_CDBURN_AREA);
|
m_ShellConstants.add("CDBURN_AREA", CSIDL_CDBURN_AREA, CSIDL_CDBURN_AREA);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
|
||||||
string get_executable_path(const char* argv0) {
|
|
||||||
#ifdef _WIN32
|
|
||||||
char temp_buf[1024];
|
|
||||||
temp_buf[0] = '\0';
|
|
||||||
int rc = GetModuleFileName(NULL,temp_buf,1024);
|
|
||||||
assert(rc != 0);
|
|
||||||
return string(temp_buf);
|
|
||||||
#else
|
|
||||||
return get_full_path(argv0);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
string get_executable_dir(const char *argv0) {
|
|
||||||
return get_dir_name(get_executable_path(argv0));
|
|
||||||
}
|
|
||||||
|
|
||||||
} // end anonymous namespace
|
|
||||||
|
|
||||||
void CEXEBuild::setdirs(const char *argv0)
|
void CEXEBuild::setdirs(const char *argv0)
|
||||||
{
|
{
|
||||||
string nsis_dir = get_executable_dir(argv0);
|
string nsis_dir = get_executable_dir(argv0);
|
||||||
|
|
|
@ -41,11 +41,13 @@ const char *NSIS_VERSION="v2.03";
|
||||||
#else
|
#else
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "build.h"
|
#include "build.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "exedata.h"
|
#include "exedata.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
int g_noconfig=0;
|
int g_noconfig=0;
|
||||||
int g_display_errors=1;
|
int g_display_errors=1;
|
||||||
|
@ -278,15 +280,8 @@ int main(int argc, char **argv)
|
||||||
if (!g_noconfig)
|
if (!g_noconfig)
|
||||||
{
|
{
|
||||||
g_noconfig=1;
|
g_noconfig=1;
|
||||||
char exepath[1024];
|
string nsisconf=get_executable_dir(argv[0])+PLATFORM_PATH_SEPARATOR_STR+"nsisconf.nsh";
|
||||||
strncpy(exepath,argv[0],sizeof(exepath)-1);
|
FILE *cfg=fopen(nsisconf.c_str(),"rt");
|
||||||
exepath[1023]=0;
|
|
||||||
char *p=exepath;
|
|
||||||
while (*p) p++;
|
|
||||||
while (p > exepath && *p != PLATFORM_PATH_SEPARATOR_C) p=CharPrev(exepath,p);
|
|
||||||
if (p>exepath) p++;
|
|
||||||
strcpy(p,"nsisconf.nsh");
|
|
||||||
FILE *cfg=fopen(exepath,"rt");
|
|
||||||
if (cfg)
|
if (cfg)
|
||||||
{
|
{
|
||||||
if (build.display_script)
|
if (build.display_script)
|
||||||
|
@ -294,7 +289,7 @@ int main(int argc, char **argv)
|
||||||
fprintf(g_output,"Processing config: \n");
|
fprintf(g_output,"Processing config: \n");
|
||||||
fflush(g_output);
|
fflush(g_output);
|
||||||
}
|
}
|
||||||
int ret=build.process_script(cfg,exepath);
|
int ret=build.process_script(cfg,(char*)nsisconf.c_str());
|
||||||
fclose(cfg);
|
fclose(cfg);
|
||||||
if (ret != PS_OK && ret != PS_EOF)
|
if (ret != PS_OK && ret != PS_EOF)
|
||||||
{
|
{
|
||||||
|
|
|
@ -536,3 +536,19 @@ string get_file_name(const string& path) {
|
||||||
return path;
|
return path;
|
||||||
return path.substr(last_separator_pos + 1, string::npos);
|
return path.substr(last_separator_pos + 1, string::npos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string get_executable_path(const char* argv0) {
|
||||||
|
#ifdef _WIN32
|
||||||
|
char temp_buf[1024];
|
||||||
|
temp_buf[0] = '\0';
|
||||||
|
int rc = GetModuleFileName(NULL,temp_buf,1024);
|
||||||
|
assert(rc != 0);
|
||||||
|
return string(temp_buf);
|
||||||
|
#else
|
||||||
|
return get_full_path(argv0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
string get_executable_dir(const char *argv0) {
|
||||||
|
return get_dir_name(get_executable_path(argv0));
|
||||||
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ size_t my_strftime(char *s, size_t max, const char *fmt, const struct tm *tm);
|
||||||
std::string get_full_path(const std::string &path);
|
std::string get_full_path(const std::string &path);
|
||||||
std::string get_dir_name(const std::string& path);
|
std::string get_dir_name(const std::string& path);
|
||||||
std::string get_file_name(const std::string& path);
|
std::string get_file_name(const std::string& path);
|
||||||
|
std::string get_executable_dir(const char *argv0);
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
char *CharPrev(const char *s, const char *p);
|
char *CharPrev(const char *s, const char *p);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue