IfFileExists

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Gluck
    Senior Member
    • Apr 2018
    • 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:



    Could someone make the spelling of this syntax? Please.
  • Anders
    Moderator
    • Jun 2002
    • 5630

    #2
    \*.* 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

    Comment

    • Gluck
      Senior Member
      • Apr 2018
      • 103

      #3
      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.

      Comment

      • Anders
        Moderator
        • Jun 2002
        • 5630

        #4
        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

        Comment

        • Gluck
          Senior Member
          • Apr 2018
          • 103

          #5
          "After it has been created you can verify that it is a folder and not a file"...

          And how can I verify it?

          Comment

          Working...
          X