![]() |
#1 |
Senior Member
Join Date: Apr 2018
Posts: 103
|
IfFileExists
I've found this code:
!define PORTABLEDIR1 "$EXEDIR\Data\MyApp" !define LOCALDIR1 "$APPDATA\MyApp" RMDir "/r" "${LOCALDIR1}-BackupBy${APPNOSPACE}Portable" Rename "${LOCALDIR1}" "${LOCALDIR1}-BackupBy${APPNOSPACE}Portable" IfFileExists "${PORTABLEDIR1}\*.*" +4 IfFileExists "$EXEDIR\Data\${APP}\*.*" 0 +5 CreateDirectory "${PORTABLEDIR1}" CopyFiles /SILENT "$EXEDIR\Data\${APP}\*.*" "${PORTABLEDIR1}" CreateDirectory "${LOCALDIR1}" CopyFiles /SILENT "${PORTABLEDIR1}\*.*" "${LOCALDIR1}" All the code is clear except for the central lines: IfFileExists "$... I've found this description: http://nsis.sourceforge.net/Reference/IfFileExists Could someone make the spelling of this syntax? Please. |
![]() |
![]() |
![]() |
#2 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,358
|
\*.* means it is checking for a directory and +4 is a relative jump but you should be using labels in your code.
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#3 |
Senior Member
Join Date: Apr 2018
Posts: 103
|
IfFileExists "${PORTABLEDIR1}\*.*" +4
But if I haven't a label, what paramenter I have to pass? What is 0 (in the second line)? I want only verify if folder exists. If not, create it. |
![]() |
![]() |
![]() |
#4 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,358
|
0 is a zero jump, continues execution on the next line. The second label/offset is optional.
You don't have to check if a folder exists, you can just create it. After it has been created you can verify that it is a folder and not a file if you really care. IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#5 |
Senior Member
Join Date: Apr 2018
Posts: 103
|
"After it has been created you can verify that it is a folder and not a file"...
And how can I verify it? |
![]() |
![]() |
![]() |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|