Added install-per-user.nsi example

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7155 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2020-03-17 19:02:42 +00:00
parent 68db5f04ee
commit 657a66f071
4 changed files with 90 additions and 3 deletions

View file

@ -88,9 +88,16 @@ This is similar to \R{getfiletime}{GetFileTime}, only it acts on the system buil
Get the path of a \W{https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid}{known folder}. The error flag is set and the output variable is empty if the call fails or the knownfolderid guid is not available. This function is only able to resolve known folders Windows Vista or higher.
\c !include WinCore.nsh
\c GetKnownFolderPath $InstDir ${FOLDERID_UserProgramFiles}
\c StrCmp $InstDir "" 0 +2
\c StrCpy $InstDir "$LocalAppData\Programs"
\c !include LogicLib.nsh
\c
\c Function .onInit
\c ${If} $InstDir == ""
\c GetKnownFolderPath $InstDir ${FOLDERID_UserProgramFiles} ; This exists on Win7+
\c StrCmp $InstDir "" 0 +2
\c StrCpy $InstDir "$LocalAppData\Programs" ; Fallback directory
\c StrCpy $InstDir "$InstDir\$(^Name)"
\c ${EndIf}
\c FunctionEnd
\S2{getfullpathname} GetFullPathName