$CMDLINE may contain quotes fix by brainsucker
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2232 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
4b5ee0523d
commit
57ea062613
2 changed files with 42 additions and 2 deletions
|
@ -13,6 +13,44 @@
|
|||
!include "${NSISDIR}\Include\WinMessages.nsh"
|
||||
!verbose 4
|
||||
|
||||
; ================= GetInstallerExeName implementation =================
|
||||
|
||||
; Adopted Get Parameter function -> now it gets full installer.exe path
|
||||
; input - nothing, output -> full path at the top of the stack
|
||||
Function GetInstallerExeName
|
||||
Push $R0
|
||||
Push $R1
|
||||
Push $R2
|
||||
StrCpy $R0 $CMDLINE 1
|
||||
StrCpy $R1 '"'
|
||||
StrCpy $R2 1
|
||||
StrCmp $R0 '"' loop
|
||||
StrCpy $R1 ' ' ; we're scanning for a space instead of a quote
|
||||
loop:
|
||||
StrCpy $R0 $CMDLINE 1 $R2
|
||||
StrCmp $R0 $R1 loop2
|
||||
StrCmp $R0 "" loop2
|
||||
IntOp $R2 $R2 + 1
|
||||
Goto loop
|
||||
loop2:
|
||||
|
||||
; Ok, have we found last exename character or string end?
|
||||
StrCmp $R0 "" "" +2
|
||||
IntOp $R2 $R2 - 1 ; last exename char
|
||||
StrCmp $R1 ' ' +3 ; was first character the '"', or something other?
|
||||
StrCpy $R1 1 ; it was quote
|
||||
Goto +2
|
||||
StrCpy $R1 0
|
||||
IntOp $R2 $R2 - $R1
|
||||
StrCpy $R0 $CMDLINE $R2 $R1
|
||||
|
||||
GetFullPathName $R0 $R0 ; expand file name to full path
|
||||
|
||||
Pop $R2
|
||||
Pop $R1
|
||||
Exch $R0
|
||||
FunctionEnd
|
||||
|
||||
; ================= systemGetFileSysTime implementation =================
|
||||
|
||||
!macro smGetFileSysTime FILENAME
|
||||
|
|
|
@ -97,11 +97,13 @@ enumex: ; End of drives or user cancel
|
|||
System::Free $1
|
||||
|
||||
; ----- Sample 6 ----- systemGetFileSysTime demo -----
|
||||
Call GetInstallerExeName
|
||||
pop $0
|
||||
|
||||
!insertmacro smGetFileSysTime $CMDLINE
|
||||
!insertmacro smGetFileSysTime $0
|
||||
System::Call '*$R0${stSYSTEMTIME}(.r1, .r2, .r3, .r4, .r5, .r6, .r7, .r8)'
|
||||
|
||||
MessageBox MB_OK "GetFileSysTime example: file '$CMDLINE', year $1, month $2, dow $3, day $4, hour $5, min $6, sec $7, ms $8"
|
||||
MessageBox MB_OK "GetFileSysTime example: file '$0', year $1, month $2, dow $3, day $4, hour $5, min $6, sec $7, ms $8"
|
||||
|
||||
; free memory from SYSTEMTIME
|
||||
System::Free $R0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue