Search code examples
macosinstallationpackagemaker

Mac PackageMaker : Do actions only if a file doesn't exist


How can I make some conditional actions only if a file doesn't exist?

I found the requirement check "If file exists" but not "If file doesn't exist".

Perhaps using an apple script in the pre-install check?

Thanks in advance for your help


Solution

  • Here's an example...

    set someFile to (path to desktop as text) & "sample.txt"
    
    tell application "Finder"
        if not (exists file someFile) then
            -- do something here
        end if
    end tell