2007-05-01 17:55:54 +00:00
|
|
|
# This script contains the following functions:
|
|
|
|
#
|
2007-05-02 23:06:01 +00:00
|
|
|
# - LaTeXCheck (check installed LaTeX-system),
|
|
|
|
# (only used by Small and Complete installer), uses:
|
2007-05-01 17:55:54 +00:00
|
|
|
# StrPointer
|
|
|
|
# StrPoint
|
|
|
|
# RevStrPointer
|
|
|
|
# RevStrPoint
|
|
|
|
#
|
2007-05-02 23:06:01 +00:00
|
|
|
# - un.DelAppPathSub and UnAppPreSuff,
|
|
|
|
# (delete the folder ~\Documents and Settings\username\Application Data\LyX for all users), uses:
|
2007-05-01 17:55:54 +00:00
|
|
|
# un.GetParentA
|
|
|
|
# un.GetUsers
|
|
|
|
# un.StrPoint
|
|
|
|
# StrPointer
|
|
|
|
# StrPoint
|
|
|
|
# UnAppPreSuff
|
|
|
|
#
|
2007-05-02 23:06:01 +00:00
|
|
|
# - CreateAppPathSub and AppPreSuff,
|
|
|
|
# (creates the folder ~\Documents and Settings\username\Application Data\LyX for all users),
|
|
|
|
# (only used by Small and Complete installer), uses:
|
2007-05-01 17:55:54 +00:00
|
|
|
# GetParentA
|
|
|
|
# GetUsers
|
|
|
|
# StrPointer
|
|
|
|
# StrPoint
|
|
|
|
# UnAppPreSuff
|
|
|
|
#
|
|
|
|
# - CheckAppPathPreferences (replaces the old install folder name with the new one in the preferences files)
|
|
|
|
# (used by Update installer), uses:
|
|
|
|
# ReplaceLineContent
|
|
|
|
#
|
|
|
|
# - IsUserAdmin (checks if user is admin)
|
|
|
|
#
|
|
|
|
# - FileCheck (checks if a given file exists)
|
|
|
|
#
|
|
|
|
#--------------------------
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
!macro StrPointer FindStr SearchStr Pointer
|
2007-05-01 17:55:54 +00:00
|
|
|
# searches for a string/character (SearchStr) in another string (FindStr)
|
|
|
|
# and returns the number of the character in the FindStr where the SearchStr was found (Pointer)
|
|
|
|
# if nothing was found or the search is impossible the Pointer is set to -1
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
StrLen $R2 ${SearchStr}
|
|
|
|
StrLen $R4 ${FindStr}
|
|
|
|
StrCpy $R5 0
|
|
|
|
${if} $R2 == 0
|
|
|
|
${orif} $R4 == 0
|
|
|
|
Goto NotFound
|
|
|
|
${endif}
|
|
|
|
IntCmp $R4 $R2 loopA NotFound
|
|
|
|
loopA:
|
|
|
|
StrCpy $R3 ${FindStr} $R2 $R5
|
|
|
|
StrCmp $R3 ${SearchStr} Found
|
|
|
|
IntOp $R5 $R5 + 1
|
|
|
|
IntCmp $R4 $R5 loopA NotFound
|
|
|
|
Goto loopA
|
|
|
|
Found:
|
|
|
|
StrCpy ${Pointer} $R5
|
|
|
|
Goto done
|
|
|
|
NotFound:
|
|
|
|
StrCpy ${Pointer} "-1"
|
|
|
|
done:
|
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#--------------------------------
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
Function StrPoint
|
|
|
|
!insertmacro StrPointer $String $Search $Pointer
|
|
|
|
FunctionEnd
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#--------------------------------
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
!macro RevStrPointer FindStr SearchStr Pointer
|
2007-05-01 17:55:54 +00:00
|
|
|
# searches for a string/character (SearchStr) in another string (FindStr) in reverse order
|
|
|
|
# and returns the number of the character in the FindStr where the SearchStr was found (Pointer)
|
|
|
|
# if nothing was found or the search is impossible the Pointer is set to +1
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
StrLen $R2 ${SearchStr}
|
|
|
|
StrLen $R4 ${FindStr}
|
|
|
|
${if} $R2 == 0
|
|
|
|
${orif} $R4 == 0
|
|
|
|
Goto NotFound
|
|
|
|
${endif}
|
|
|
|
IntCmp $R4 $R2 loopA NotFound
|
|
|
|
StrCpy $R5 "-$R2"
|
|
|
|
loopA:
|
|
|
|
StrCpy $R3 ${FindStr} $R2 $R5
|
|
|
|
StrCmp $R3 ${SearchStr} Found
|
|
|
|
IntOp $R5 $R5 - 1
|
|
|
|
IntCmp "$R5" "-$R4" loopA NotFound
|
|
|
|
Goto loopA
|
|
|
|
Found:
|
|
|
|
StrCpy ${Pointer} $R5
|
|
|
|
Goto done
|
|
|
|
NotFound:
|
|
|
|
StrCpy ${Pointer} "+1"
|
|
|
|
done:
|
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#--------------------------------
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2007-05-02 23:06:01 +00:00
|
|
|
!if ${INSTALLER_TYPE} == "NotUpdate" # only for Small and Complete installer
|
|
|
|
|
|
|
|
Function RevStrPoint
|
|
|
|
!insertmacro RevStrPointer $String $Search $Pointer
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
!endif # endif ${INSTALLER_TYPE} == "NotUpdate"
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#--------------------------------
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
!macro AppPreSuff AppPre AppSuff
|
2007-05-01 17:55:54 +00:00
|
|
|
# the APPDATA path has always the following structure:
|
|
|
|
# C:\Documents and Settings\username\Application Data
|
|
|
|
# this macro saves the "C:\Documents and Settings\" substring into the variable "AppPre"
|
|
|
|
# and the "Application Data" substring into the variable "AppSuff"
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
StrCpy $String "$APPDATA"
|
|
|
|
StrCpy $Search "\"
|
2007-05-01 17:55:54 +00:00
|
|
|
Call StrPoint # search for the first "\"
|
|
|
|
IntOp $Pointer $Pointer + 1 # jump after the "\"
|
|
|
|
StrCpy $String $String "" $Pointer # cut off the part before the first "\"
|
2007-02-08 21:09:30 +00:00
|
|
|
StrCpy $0 $Pointer
|
2007-05-01 17:55:54 +00:00
|
|
|
Call StrPoint # search for the second "\"
|
|
|
|
IntOp $0 $0 + $Pointer # $0 is now the pointer to the second "\" in the APPDATA string
|
|
|
|
StrCpy ${AppPre} $APPDATA $0 # save the part before the second "\"
|
|
|
|
IntOp $Pointer $Pointer + 1 # jump after the "\"
|
|
|
|
StrCpy $String $String "" $Pointer # cut off the part before the second "\"
|
|
|
|
Call StrPoint # search for the third "\"
|
|
|
|
IntOp $Pointer $Pointer + 1 # jump after the "\"
|
|
|
|
StrCpy ${AppSuff} $String "" $Pointer # save the part after the third "\"
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#--------------------------------
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2007-04-15 10:22:49 +00:00
|
|
|
Function GetParentA
|
2007-05-01 17:55:54 +00:00
|
|
|
# deletes a subfolder of the APPDATA path for all users
|
|
|
|
# used by the function "un.getUsers"
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
Exch $R0
|
|
|
|
Push $R1
|
|
|
|
Push $R2
|
|
|
|
Push $R3
|
|
|
|
StrCpy $R1 0
|
|
|
|
StrLen $R2 $R0
|
|
|
|
loop:
|
|
|
|
IntOp $R1 $R1 + 1
|
|
|
|
IntCmp $R1 $R2 get 0 get
|
|
|
|
StrCpy $R3 $R0 1 -$R1
|
|
|
|
StrCmp $R3 "\" get
|
|
|
|
Goto loop
|
|
|
|
get:
|
|
|
|
StrCpy $R0 $R0 -$R1
|
|
|
|
Pop $R3
|
|
|
|
Pop $R2
|
|
|
|
Pop $R1
|
|
|
|
Exch $R0
|
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#--------------------------------
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
Function GetUsers
|
2007-05-01 17:55:54 +00:00
|
|
|
# reads the subfolders of the "Documents and Settings" folder to get a list of the users
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
StrCpy $R3 ""
|
|
|
|
Push "$PROFILE"
|
2007-04-15 10:22:49 +00:00
|
|
|
Call GetParentA
|
2007-02-08 21:09:30 +00:00
|
|
|
Pop $R2
|
|
|
|
StrCpy $R2 "$R2"
|
|
|
|
FindFirst $R0 $R1 "$R2\*"
|
|
|
|
StrCmp $R1 "" findend 0
|
|
|
|
findloop:
|
|
|
|
IfFileExists "$R2\$R1\*.*" 0 notDir
|
|
|
|
StrCmp $R1 "." notDir
|
|
|
|
StrCmp $R1 ".." notDir
|
|
|
|
StrCmp $R1 "All Users" notDir
|
|
|
|
StrCmp $R1 "Default User" notDir
|
|
|
|
StrCmp $R1 "All Users.WINNT" notDir
|
|
|
|
StrCmp $R1 "Default User.WINNT" notDir
|
|
|
|
StrCpy $R3 "$R3|$R1"
|
|
|
|
notDir:
|
|
|
|
FindNext $R0 $R1
|
|
|
|
StrCmp $R1 "" findend 0
|
|
|
|
Goto findloop
|
|
|
|
findend:
|
|
|
|
FindClose $R0
|
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#--------------------------------
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2007-04-15 10:22:49 +00:00
|
|
|
Function un.GetParentA
|
2007-05-01 17:55:54 +00:00
|
|
|
# deletes a subfolder of the APPDATA path for all users
|
|
|
|
# used by the function "un.getUsers"
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
Exch $R0
|
|
|
|
Push $R1
|
|
|
|
Push $R2
|
|
|
|
Push $R3
|
|
|
|
StrCpy $R1 0
|
|
|
|
StrLen $R2 $R0
|
|
|
|
loop:
|
|
|
|
IntOp $R1 $R1 + 1
|
|
|
|
IntCmp $R1 $R2 get 0 get
|
|
|
|
StrCpy $R3 $R0 1 -$R1
|
|
|
|
StrCmp $R3 "\" get
|
|
|
|
Goto loop
|
|
|
|
get:
|
|
|
|
StrCpy $R0 $R0 -$R1
|
|
|
|
Pop $R3
|
|
|
|
Pop $R2
|
|
|
|
Pop $R1
|
|
|
|
Exch $R0
|
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#--------------------------------
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
Function un.GetUsers
|
2007-05-01 17:55:54 +00:00
|
|
|
# reads the subfolders of the "Documents and Settings" folder to get a list of the users
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
StrCpy $R3 ""
|
|
|
|
Push "$PROFILE"
|
2007-04-15 10:22:49 +00:00
|
|
|
Call un.GetParentA
|
2007-02-08 21:09:30 +00:00
|
|
|
Pop $R2
|
|
|
|
StrCpy $R2 "$R2"
|
|
|
|
FindFirst $R0 $R1 "$R2\*"
|
|
|
|
StrCmp $R1 "" findend 0
|
|
|
|
findloop:
|
|
|
|
IfFileExists "$R2\$R1\*.*" 0 notDir
|
|
|
|
StrCmp $R1 "." notDir
|
|
|
|
StrCmp $R1 ".." notDir
|
|
|
|
StrCmp $R1 "All Users" notDir
|
|
|
|
StrCmp $R1 "Default User" notDir
|
|
|
|
StrCmp $R1 "All Users.WINNT" notDir
|
|
|
|
StrCmp $R1 "Default User.WINNT" notDir
|
|
|
|
StrCpy $R3 "$R3|$R1"
|
|
|
|
notDir:
|
|
|
|
FindNext $R0 $R1
|
|
|
|
StrCmp $R1 "" findend 0
|
|
|
|
Goto findloop
|
|
|
|
findend:
|
|
|
|
FindClose $R0
|
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#--------------------------------
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
Function un.StrPoint
|
|
|
|
!insertmacro StrPointer $String $Search $Pointer
|
|
|
|
FunctionEnd
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#--------------------------------
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
!macro UnAppPreSuff AppPre AppSuff
|
2007-05-01 17:55:54 +00:00
|
|
|
# the APPDATA path has always the following structure:
|
|
|
|
# C:\Documents and Settings\username\Application Data
|
|
|
|
# this macro saves the "C:\Documents and Settings\" substring into the variable "AppPre"
|
|
|
|
# and the "Application Data" substring into the variable "AppSuff"
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
StrCpy $String "$APPDATA"
|
|
|
|
StrCpy $Search "\"
|
2007-05-01 17:55:54 +00:00
|
|
|
Call un.StrPoint # search for the first "\"
|
|
|
|
IntOp $Pointer $Pointer + 1 # jump after the "\"
|
|
|
|
StrCpy $String $String "" $Pointer # cut off the part before the first "\"
|
2007-02-08 21:09:30 +00:00
|
|
|
StrCpy $0 $Pointer
|
2007-05-01 17:55:54 +00:00
|
|
|
Call un.StrPoint # search for the second "\"
|
|
|
|
IntOp $0 $0 + $Pointer # $0 is now the pointer to the second "\" in the APPDATA string
|
|
|
|
StrCpy ${AppPre} $APPDATA $0 # save the part before the second "\"
|
|
|
|
IntOp $Pointer $Pointer + 1 # jump after the "\"
|
|
|
|
StrCpy $String $String "" $Pointer # cut off the part before the second "\"
|
|
|
|
Call un.StrPoint # search for the third "\"
|
|
|
|
IntOp $Pointer $Pointer + 1 # jump after the "\"
|
|
|
|
StrCpy ${AppSuff} $String "" $Pointer # save the part after the third "\"
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#--------------------------------
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
Function un.DelAppPathSub
|
2007-05-01 17:55:54 +00:00
|
|
|
# deletes a subfolder of the APPDATA path for all users
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# get list of all users
|
2007-02-08 21:09:30 +00:00
|
|
|
Push $R0
|
|
|
|
Push $R1
|
|
|
|
Push $R2
|
|
|
|
Push $R3
|
|
|
|
Call un.GetUsers
|
2007-05-01 17:55:54 +00:00
|
|
|
StrCpy $UserList $R3 "" 1 # cut off the "|" at the end of the list
|
2007-02-08 21:09:30 +00:00
|
|
|
Pop $R3
|
|
|
|
Pop $R2
|
|
|
|
Pop $R1
|
|
|
|
Pop $R0
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# the usernames in the list of all users is separated by "|"
|
2007-02-08 21:09:30 +00:00
|
|
|
loop:
|
|
|
|
StrCpy $String "$UserList"
|
|
|
|
StrCpy $Search "|"
|
2007-05-01 17:55:54 +00:00
|
|
|
Call un.StrPoint # search for the "|"
|
2007-02-08 21:09:30 +00:00
|
|
|
StrCmp $Pointer "-1" ready
|
2007-05-01 17:55:54 +00:00
|
|
|
StrCpy $0 $UserList $Pointer # $0 contains now the username
|
|
|
|
IntOp $Pointer $Pointer + 1 # jump after the "|"
|
|
|
|
StrCpy $UserList $UserList "" $Pointer # cut off the first username in the list
|
|
|
|
# generate the string for the current user
|
|
|
|
# AppPre and AppSuff are generated in the macro "AppPreSuff"
|
2008-06-04 01:26:56 +00:00
|
|
|
RMDir /r "$AppPre\$0\$AppSuff\$AppSubfolder" # delete the folder
|
2007-02-08 21:09:30 +00:00
|
|
|
Goto loop
|
|
|
|
ready:
|
|
|
|
StrCpy $0 $UserList
|
2008-06-04 01:26:56 +00:00
|
|
|
RMDir /r "$AppPre\$0\$AppSuff\$AppSubfolder" # delete the folder
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#--------------------------------
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2007-05-02 23:06:01 +00:00
|
|
|
!if ${INSTALLER_TYPE} == "NotUpdate" # only for Small and Complete installer
|
|
|
|
|
|
|
|
Function CreateAppPathSub
|
2007-05-01 17:55:54 +00:00
|
|
|
# creates a subfolder of the APPDATA path for all users
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# get folder names
|
2007-02-08 21:09:30 +00:00
|
|
|
!insertmacro AppPreSuff $AppPre $AppSuff
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# get list of all users
|
2007-02-08 21:09:30 +00:00
|
|
|
Push $R0
|
|
|
|
Push $R1
|
|
|
|
Push $R2
|
|
|
|
Push $R3
|
|
|
|
Call GetUsers
|
2007-05-01 17:55:54 +00:00
|
|
|
StrCpy $UserList $R3 "" 1 # cut off the "|" at the end of the list
|
2007-02-08 21:09:30 +00:00
|
|
|
Pop $R3
|
|
|
|
Pop $R2
|
|
|
|
Pop $R1
|
|
|
|
Pop $R0
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# the usernames in the list of all users is separated by "|"
|
2007-02-08 21:09:30 +00:00
|
|
|
loop:
|
|
|
|
StrCpy $String "$UserList"
|
|
|
|
StrCpy $Search "|"
|
2007-05-01 17:55:54 +00:00
|
|
|
Call StrPoint # search for the "|"
|
|
|
|
StrCmp $Pointer "-1" ready # the loop is finished when no "|" could be found
|
|
|
|
StrCpy $0 $UserList $Pointer # $0 contains now the username
|
|
|
|
IntOp $Pointer $Pointer + 1 # jump after the "|"
|
|
|
|
StrCpy $UserList $UserList "" $Pointer # cut off the first username in the list
|
|
|
|
# generate the string for the current user
|
|
|
|
# AppPre and AppSuff are generated in the macro "AppPreSuff"
|
2008-06-04 01:26:56 +00:00
|
|
|
CreateDirectory "$AppPre\$0\$AppSuff\$AppSubfolder" # create the folder
|
|
|
|
CopyFiles "$AppFiles" "$AppPre\$0\$AppSuff\$AppSubfolder"
|
2007-02-08 21:09:30 +00:00
|
|
|
Goto loop
|
|
|
|
ready:
|
2007-05-01 17:55:54 +00:00
|
|
|
# now do the same for the last user name
|
2007-02-08 21:09:30 +00:00
|
|
|
StrCpy $0 $UserList
|
2008-06-04 01:26:56 +00:00
|
|
|
CreateDirectory "$AppPre\$0\$AppSuff\$AppSubfolder" # create the folder
|
|
|
|
CopyFiles "$AppFiles" "$AppPre\$0\$AppSuff\$AppSubfolder"
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2007-05-02 23:06:01 +00:00
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
!endif # endif ${INSTALLER_TYPE} == "NotUpdate"
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#--------------------------------
|
2007-04-15 10:22:49 +00:00
|
|
|
|
2007-05-02 23:06:01 +00:00
|
|
|
!if ${INSTALLER_TYPE} == "Update" # only for Update installer
|
|
|
|
|
|
|
|
Function ReplaceLineContent
|
2007-05-01 17:55:54 +00:00
|
|
|
# replaces "$OldString" with "LyX $NewString"
|
2007-04-15 10:22:49 +00:00
|
|
|
|
2007-05-02 23:06:01 +00:00
|
|
|
${WordReplace} '$R9' "$OldString" "$NewString" "+" '$R9' # macro from WordFunc.nsh
|
|
|
|
Push $0
|
2007-04-15 10:22:49 +00:00
|
|
|
|
2007-05-02 23:06:01 +00:00
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
!endif # endif ${INSTALLER_TYPE} == "Update"
|
2007-04-15 10:22:49 +00:00
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#--------------------------------
|
2007-04-15 10:22:49 +00:00
|
|
|
|
2007-05-02 23:06:01 +00:00
|
|
|
!if ${INSTALLER_TYPE} == "Update" # only for Update installer
|
|
|
|
|
|
|
|
Function CheckAppPathPreferences
|
2007-05-01 17:55:54 +00:00
|
|
|
# replaces a string "$OldString" with "$NewString" in a file "$FileName"
|
2007-04-15 10:22:49 +00:00
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# get folder names
|
2007-04-15 10:22:49 +00:00
|
|
|
!insertmacro AppPreSuff $AppPre $AppSuff
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# get list of all users
|
2007-04-15 10:22:49 +00:00
|
|
|
Push $R0
|
|
|
|
Push $R1
|
|
|
|
Push $R2
|
|
|
|
Push $R3
|
|
|
|
Call GetUsers
|
2007-05-01 17:55:54 +00:00
|
|
|
StrCpy $UserList $R3 "" 1 # cut off the "|" at the end of the list
|
2007-04-15 10:22:49 +00:00
|
|
|
Pop $R3
|
|
|
|
Pop $R2
|
|
|
|
Pop $R1
|
|
|
|
Pop $R0
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# the usernames in the list of all users is separated by "|"
|
2007-04-15 22:03:42 +00:00
|
|
|
loopPrefs:
|
2007-04-15 10:22:49 +00:00
|
|
|
StrCpy $String "$UserList"
|
|
|
|
StrCpy $Search "|"
|
2007-05-01 17:55:54 +00:00
|
|
|
Call StrPoint # search for the "|"
|
|
|
|
StrCmp $Pointer "-1" ready # the loop is finished when no "|" could be found
|
|
|
|
StrCpy $0 $UserList $Pointer # $0 contains now the username
|
|
|
|
IntOp $Pointer $Pointer + 1 # jump after the "|"
|
|
|
|
StrCpy $UserList $UserList "" $Pointer # cut off the first username in the list
|
|
|
|
# generate the string for the current user
|
|
|
|
# AppPre and AppSuff are generated in the macro "AppPreSuff"
|
2008-07-26 21:08:01 +00:00
|
|
|
StrCpy $AppPath "$AppPre\$0\$AppSuff\$AppSubfolder"
|
2007-05-01 17:55:54 +00:00
|
|
|
# read the preferences file to test if it exists
|
2007-04-19 00:55:52 +00:00
|
|
|
FileOpen $R1 "$AppPath\$FileName" r
|
2007-04-15 10:22:49 +00:00
|
|
|
IfErrors doneA
|
|
|
|
FileClose $R1
|
2007-05-01 17:55:54 +00:00
|
|
|
# search for "$OldString" and replace it with "$NewString"
|
|
|
|
${LineFind} "$AppPath\$FileName" "" "1:-1" "ReplaceLineContent" # macro from TextFunc.nsh # calls Function ReplaceLineContent
|
2007-04-15 10:22:49 +00:00
|
|
|
doneA:
|
2007-04-15 22:03:42 +00:00
|
|
|
Goto loopPrefs
|
2007-04-15 10:22:49 +00:00
|
|
|
ready:
|
2007-05-01 17:55:54 +00:00
|
|
|
# now do the same for the last user name
|
2007-04-15 10:22:49 +00:00
|
|
|
StrCpy $0 $UserList
|
2008-07-26 21:08:01 +00:00
|
|
|
StrCpy $AppPath "$AppPre\$0\$AppSuff\$AppSubfolder"
|
2007-04-19 00:55:52 +00:00
|
|
|
FileOpen $R1 "$AppPath\$FileName" r
|
2007-04-15 10:22:49 +00:00
|
|
|
IfErrors doneB
|
|
|
|
FileClose $R1
|
2007-04-19 00:55:52 +00:00
|
|
|
${LineFind} "$AppPath\$FileName" "" "1:-1" "ReplaceLineContent"
|
2007-04-15 10:22:49 +00:00
|
|
|
doneB:
|
|
|
|
|
2007-05-02 23:06:01 +00:00
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
!endif # endif ${INSTALLER_TYPE} == "Update"
|
2007-04-15 10:22:49 +00:00
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#--------------------------------
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
!macro IsUserAdmin Result Name
|
|
|
|
|
|
|
|
ClearErrors
|
|
|
|
UserInfo::GetName
|
|
|
|
IfErrors Win9x
|
|
|
|
Pop $0
|
|
|
|
StrCpy ${Name} $0
|
|
|
|
UserInfo::GetAccountType
|
|
|
|
Pop $1
|
|
|
|
${if} $1 == "Admin"
|
|
|
|
StrCpy ${Result} "yes"
|
|
|
|
${else}
|
|
|
|
StrCpy ${Result} "no"
|
|
|
|
${endif}
|
|
|
|
Goto done
|
|
|
|
|
|
|
|
Win9x:
|
|
|
|
StrCpy ${Result} "yes"
|
|
|
|
done:
|
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#--------------------------------
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
!macro FileCheck Result FileName FilePath
|
2007-05-01 17:55:54 +00:00
|
|
|
# checks if a file exists, returns "True" or "False"
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
Push $0
|
|
|
|
Push $1
|
|
|
|
StrCpy $0 ""
|
|
|
|
StrCpy $1 ""
|
|
|
|
FileOpen $0 "${Filepath}\${FileName}" r
|
|
|
|
${if} $0 = ""
|
|
|
|
StrCpy $1 "False"
|
|
|
|
${Else}
|
|
|
|
StrCpy $1 "True"
|
|
|
|
${endif}
|
|
|
|
FileClose $0
|
|
|
|
StrCpy ${Result} $1
|
|
|
|
Pop $1
|
|
|
|
Pop $0
|
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#------------------------------------------
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2007-05-02 23:06:01 +00:00
|
|
|
!if ${INSTALLER_TYPE} == "NotUpdate" # only for Small and Complete installer
|
|
|
|
|
|
|
|
Function LaTeXCheck
|
2007-05-01 17:55:54 +00:00
|
|
|
# searches the string "$Search" in the string "$String" and extracts the path around it
|
|
|
|
# the extracted path is checked if the file "latex.exe" is in it
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
StartCheck:
|
|
|
|
StrLen $3 $String
|
|
|
|
Call StrPoint
|
2007-05-01 17:55:54 +00:00
|
|
|
${if} $Pointer == "-1" # if nothing was found
|
2007-02-08 21:09:30 +00:00
|
|
|
StrCpy $LatexPath ""
|
|
|
|
Return
|
|
|
|
${endif}
|
|
|
|
IntOp $3 $3 - $Pointer
|
2007-05-01 17:55:54 +00:00
|
|
|
StrCpy $4 $String $3 "-$3" # $4 is now the part behind the $Search string
|
|
|
|
StrCpy $String $String $Pointer # $String is now the part before the $Search string
|
|
|
|
StrCpy $Search ":" # search for the ":" after the first previous drive letter
|
2007-02-08 21:09:30 +00:00
|
|
|
Call RevStrPoint
|
2007-05-01 17:55:54 +00:00
|
|
|
IntOp $Pointer $Pointer - 1 # jump before the ":" to the drive letter
|
|
|
|
StrCpy $Pointer $Pointer "" 1 # cut of the "-" sign
|
2007-02-08 21:09:30 +00:00
|
|
|
StrCpy $LatexPath $String $Pointer "-$Pointer"
|
|
|
|
StrCpy $String $4
|
2007-05-01 17:55:54 +00:00
|
|
|
StrCpy $Search ";" # search for the following ";" that separates the different paths
|
2007-02-08 21:09:30 +00:00
|
|
|
Call StrPoint
|
2007-05-01 17:55:54 +00:00
|
|
|
${if} $Pointer != "-1" # if something was found
|
2007-02-08 21:09:30 +00:00
|
|
|
StrCpy $String $String $Pointer
|
|
|
|
${endif}
|
|
|
|
StrCpy $LatexPath "$LatexPath$String"
|
2007-05-01 17:55:54 +00:00
|
|
|
# check if the latex.exe exists in the $LatexPath folder
|
2007-02-08 21:09:30 +00:00
|
|
|
!insertmacro FileCheck $5 "latex.exe" "$LatexPath"
|
2007-05-01 17:55:54 +00:00
|
|
|
${if} $5 == "False" # delete the entry with the wrong path to the latex.exe and try again
|
2007-02-08 21:09:30 +00:00
|
|
|
StrCpy $LatexPath ""
|
|
|
|
StrLen $3 $String
|
|
|
|
StrCpy $String $4 "" $3
|
|
|
|
${if} $2 == "TeXLive"
|
|
|
|
StrCpy $Search "TeXLive"
|
|
|
|
${else}
|
|
|
|
StrCpy $Search "miktex"
|
|
|
|
${endif}
|
|
|
|
Goto StartCheck
|
|
|
|
${endif}
|
|
|
|
|
2007-05-02 23:06:01 +00:00
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
!endif # endif ${INSTALLER_TYPE} == "NotUpdate"
|
2007-02-08 21:09:30 +00:00
|
|
|
|