Process the auto-appeneded part of InstallDir at compile-time
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2613 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
a68f3ac2e1
commit
e406ae6c1c
4 changed files with 28 additions and 15 deletions
|
@ -266,6 +266,7 @@ CEXEBuild::CEXEBuild()
|
|||
build_strlist.add("",0);
|
||||
ubuild_strlist.add("",0);
|
||||
build_header.install_directory_ptr=0;
|
||||
build_header.install_directory_auto_append=0;
|
||||
build_header.install_reg_key_ptr=0;
|
||||
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
||||
memset(build_header.install_types,0,sizeof(build_header.install_types));
|
||||
|
|
|
@ -73,7 +73,7 @@ static void NSISCALL outernotify(char num) {
|
|||
|
||||
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
|
||||
BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
static int CALLBACK WINAPI BrowseCallbackProc( HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData);
|
||||
static int CALLBACK WINAPI BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData);
|
||||
#ifdef NSIS_CONFIG_LICENSEPAGE
|
||||
static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
#endif
|
||||
|
@ -706,11 +706,11 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
}
|
||||
if (id == IDC_BROWSE)
|
||||
{
|
||||
char name[256];
|
||||
char name[MAX_PATH];
|
||||
char str[256];
|
||||
BROWSEINFO bi={0,};
|
||||
ITEMIDLIST *idlist;
|
||||
GetUIText(IDC_DIR,name,256);
|
||||
GetUIText(IDC_DIR,name,MAX_PATH);
|
||||
GetUIText(IDC_SELDIRTEXT,str,256);
|
||||
bi.hwndOwner = hwndDlg;
|
||||
bi.pszDisplayName = name;
|
||||
|
@ -721,25 +721,22 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
#define BIF_NEWDIALOGSTYLE 0x0040
|
||||
#endif
|
||||
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;
|
||||
idlist = SHBrowseForFolder( &bi );
|
||||
idlist = SHBrowseForFolder(&bi);
|
||||
if (idlist)
|
||||
{
|
||||
const char *post_str;
|
||||
const char *p;
|
||||
IMalloc *m;
|
||||
SHGetPathFromIDList( idlist, name );
|
||||
SHGetPathFromIDList(idlist, name);
|
||||
SHGetMalloc(&m);
|
||||
if (m)
|
||||
{
|
||||
m->lpVtbl->Free(m,idlist);
|
||||
m->lpVtbl->Release(m);
|
||||
}
|
||||
post_str=GetStringFromStringTab(g_inst_header->install_directory_ptr);
|
||||
|
||||
p=scanendslash(post_str);
|
||||
if (p >= post_str && *++p)
|
||||
if (g_inst_header->install_directory_auto_append)
|
||||
{
|
||||
post_str=process_string(p);
|
||||
const char *p, *post_str=ps_tmpbuf;
|
||||
process_string_fromtab(0,g_inst_header->install_directory_auto_append);
|
||||
p=name+mystrlen(name)-mystrlen(post_str);
|
||||
if (p <= name || *CharPrev(name,p)!='\\' || lstrcmpi(p,post_str))
|
||||
{
|
||||
|
|
|
@ -383,7 +383,9 @@ typedef struct
|
|||
// common settings
|
||||
common_header common;
|
||||
|
||||
int install_reg_rootkey, install_reg_key_ptr, install_reg_value_ptr;
|
||||
int install_reg_rootkey;
|
||||
// these two are not processed!
|
||||
int install_reg_key_ptr, install_reg_value_ptr;
|
||||
|
||||
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
||||
int install_types[NSIS_MAX_INST_TYPES];
|
||||
|
@ -393,8 +395,8 @@ typedef struct
|
|||
int license_bg; // license background color
|
||||
#endif//NSIS_CONFIG_LICENSEPAGE
|
||||
|
||||
// below here, the strings are processed (can have variables etc)
|
||||
int install_directory_ptr; // default install dir.
|
||||
int install_directory_auto_append; // auto append part
|
||||
|
||||
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
||||
int uninstdata_offset; // -1 if no uninst data.
|
||||
|
@ -418,7 +420,6 @@ typedef struct
|
|||
// Strings specific to uninstallers
|
||||
typedef struct
|
||||
{
|
||||
// unprocessed strings
|
||||
int uninstbutton;
|
||||
int uninstalltext;
|
||||
int uninstalltext2;
|
||||
|
|
|
@ -1288,12 +1288,26 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
|
|||
SCRIPT_MSG("OutFile: \"%s\"\n",build_output_filename);
|
||||
return make_sure_not_in_secorfunc(line.gettoken_str(0));
|
||||
case TOK_INSTDIR:
|
||||
{
|
||||
char *p = line.gettoken_str(1);
|
||||
if (build_header.install_directory_ptr)
|
||||
{
|
||||
warning("%s: specified multiple times. wasting space (%s:%d)",line.gettoken_str(0),curfilename,linecnt);
|
||||
}
|
||||
build_header.install_directory_ptr = add_string_main(line.gettoken_str(1));
|
||||
build_header.install_directory_ptr = add_string_main(p);
|
||||
build_header.install_directory_auto_append = 0;
|
||||
if (*p && p[strlen(p)-1] != '\\')
|
||||
{
|
||||
p = build_strlist.get() + build_header.install_directory_ptr;
|
||||
char *p2 = strrchr(p, '\\');
|
||||
if (p2)
|
||||
{
|
||||
p2++;
|
||||
build_header.install_directory_auto_append = build_header.install_directory_ptr + (p2 - p);
|
||||
}
|
||||
}
|
||||
SCRIPT_MSG("InstallDir: \"%s\"\n",line.gettoken_str(1));
|
||||
}
|
||||
return make_sure_not_in_secorfunc(line.gettoken_str(0));
|
||||
case TOK_INSTALLDIRREGKEY: // InstallDirRegKey
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue