/NOCD instead of /CD
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1704 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
1f9aee2b38
commit
be7192efb7
6 changed files with 449 additions and 443 deletions
|
@ -37,6 +37,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, char *cmdParam, int cmd
|
|||
my_memset(&g_resize,0,sizeof(NRESIZEDATA));
|
||||
my_memset(&g_find,0,sizeof(NFINDREPLACE));
|
||||
g_sdata.hInstance=GetModuleHandle(0);
|
||||
g_sdata.script_alloced=false;
|
||||
g_sdata.script=GetCommandLine();
|
||||
JNL::open_socketlib();
|
||||
if (*g_sdata.script=='"') { g_sdata.script++; while (*g_sdata.script && *g_sdata.script++!='"' ); }
|
||||
|
@ -65,6 +66,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, char *cmdParam, int cmd
|
|||
}
|
||||
}
|
||||
JNL::close_socketlib();
|
||||
if (g_sdata.script_alloced) GlobalFree(g_sdata.script);
|
||||
ExitProcess(msg.wParam);
|
||||
return msg.wParam;
|
||||
}
|
||||
|
@ -132,8 +134,9 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
|||
if (num==1) {
|
||||
DragQueryFile((HDROP)wParam,0,szTmp,MAX_PATH);
|
||||
if (lstrlen(szTmp)>0) {
|
||||
g_sdata.script_alloced = true;
|
||||
g_sdata.script = (char *)GlobalAlloc(GPTR,sizeof(szTmp)+7);
|
||||
wsprintf(g_sdata.script,"/CD \"%s\"",szTmp);
|
||||
wsprintf(g_sdata.script,"\"%s\"",szTmp);
|
||||
ResetObjects();
|
||||
CompileNSISScript();
|
||||
}
|
||||
|
@ -247,7 +250,7 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
|||
{
|
||||
if (!g_sdata.thread) {
|
||||
OPENFILENAME l={sizeof(l),};
|
||||
char buf[MAX_STRING];
|
||||
char buf[MAX_PATH];
|
||||
l.hwndOwner = hwndDlg;
|
||||
l.lpstrFilter = "NSIS Script (*.nsi)\0*.nsi\0All Files (*.*)\0*.*\0";
|
||||
l.lpstrFile = buf;
|
||||
|
@ -259,8 +262,8 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
|||
l.Flags = OFN_HIDEREADONLY|OFN_EXPLORER|OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST;
|
||||
lstrcpy(buf,"");
|
||||
if (GetOpenFileName(&l)) {
|
||||
g_sdata.script = (char *)GlobalAlloc(GPTR,sizeof(buf)+7);
|
||||
wsprintf(g_sdata.script,"/CD \"%s\"",buf);
|
||||
g_sdata.script = (char *)GlobalAlloc(GPTR,lstrlen(buf)+3);
|
||||
wsprintf(g_sdata.script,"\"%s\"",buf);
|
||||
ResetObjects();
|
||||
CompileNSISScript();
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ void CompileNSISScript();
|
|||
DWORD CALLBACK UpdateThread(LPVOID v);
|
||||
|
||||
typedef struct NSISScriptData {
|
||||
bool script_alloced;
|
||||
char *script;
|
||||
char *output_exe;
|
||||
char *input_script;
|
||||
|
|
|
@ -165,8 +165,10 @@ void CompileNSISScript() {
|
|||
}
|
||||
if (!g_sdata.appended) {
|
||||
if (s) GlobalFree(s);
|
||||
s = (char *)GlobalAlloc(GPTR, lstrlen(g_sdata.script)+lstrlen(EXENAME)+2);
|
||||
s = (char *)GlobalAlloc(GPTR, lstrlen(g_sdata.script)+sizeof(EXENAME)+2);
|
||||
wsprintf(s,"%s %s",EXENAME,g_sdata.script);
|
||||
if (g_sdata.script_alloced) GlobalFree(g_sdata.script);
|
||||
g_sdata.script_alloced = true;
|
||||
g_sdata.script = s;
|
||||
g_sdata.appended = TRUE;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ If you want to use MakeNSIS on the command line, the syntax of the makensis comm
|
|||
|
||||
\b /HDRINFO prints out information on what options Makensis was compiled with.
|
||||
|
||||
\b /CD tells the compiler to switch to the directory of the script it is currently compiling.
|
||||
\b /NOCD disabled the current directory change to that of the .nsi file
|
||||
|
||||
\b Using the /D switch one or more times will add to symbols to the globally defined list (See !define).
|
||||
|
||||
|
|
|
@ -111,9 +111,9 @@ Section "NSI Development Shell Extensions" SecExtention
|
|||
WriteRegStr HKCR "NSISFile\DefaultIcon" "" $INSTDIR\makensisw.exe,1
|
||||
WriteRegStr HKCR "NSISFile\shell\open\command" "" 'notepad.exe "%1"'
|
||||
WriteRegStr HKCR "NSISFile\shell\compile" "" "Compile NSI"
|
||||
WriteRegStr HKCR "NSISFile\shell\compile\command" "" '"$INSTDIR\makensisw.exe" /CD "%1"'
|
||||
WriteRegStr HKCR "NSISFile\shell\compile\command" "" '"$INSTDIR\makensisw.exe" "%1"'
|
||||
WriteRegStr HKCR "NSISFile\shell\compile-bz2" "" "Compile NSI (with bz2)"
|
||||
WriteRegStr HKCR "NSISFile\shell\compile-bz2\command" "" '"$INSTDIR\makensisw.exe" /CD /X"SetCompressor bzip2" "%1"'
|
||||
WriteRegStr HKCR "NSISFile\shell\compile-bz2\command" "" '"$INSTDIR\makensisw.exe" /X"SetCompressor bzip2" "%1"'
|
||||
SectionEnd
|
||||
|
||||
Section "Start Menu + Desktop Shortcuts" SecIcons
|
||||
|
|
|
@ -69,7 +69,7 @@ static void sigint(int sig)
|
|||
int main(int argc, char **argv)
|
||||
{
|
||||
CEXEBuild build;
|
||||
int do_cd=0;
|
||||
int do_cd=1;
|
||||
int outputtried=0;
|
||||
int argpos=1;
|
||||
int nousage=0;
|
||||
|
@ -163,7 +163,7 @@ int main(int argc, char **argv)
|
|||
outputtried=1;
|
||||
}
|
||||
}
|
||||
else if (!stricmp(argv[argpos],"/CD")) do_cd=1;
|
||||
else if (!stricmp(argv[argpos],"/NOCD")) do_cd=0;
|
||||
else if (argv[argpos][0] == '/' && (argv[argpos][1] == 'V' || argv[argpos][1] == 'v') &&
|
||||
argv[argpos][2] >= '0' && argv[argpos][2] <= '4' && !argv[argpos][3])
|
||||
{
|
||||
|
@ -316,7 +316,7 @@ int main(int argc, char **argv)
|
|||
{
|
||||
if (build.display_errors)
|
||||
{
|
||||
fprintf(g_output,"Error changing directory to \"%s\" (/CD specified)\n",dirbuf);
|
||||
fprintf(g_output,"Error changing directory to \"%s\"\n",dirbuf);
|
||||
fflush(g_output);
|
||||
}
|
||||
return 1;
|
||||
|
@ -371,7 +371,7 @@ int main(int argc, char **argv)
|
|||
" /Ofile specifies a text file to log compiler output (default is stdout)\n"
|
||||
" /PAUSE pauses after execution\n"
|
||||
" /NOCONFIG disables inclusion of <path to makensis.exe>\\nsisconf.nsh\n"
|
||||
" /CD makes makensis change the current directory to that of the .nsi file\n"
|
||||
" /NOCD disabled the current directory change to that of the .nsi file\n"
|
||||
" /Ddefine[=value] defines the symbol \"define\" for the script [to value]\n"
|
||||
" /Xscriptcmd executes scriptcmd in script (i.e. \"/XOutFile poop.exe\")\n"
|
||||
" for script file name, you can use - to read from the standard input\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue