简体   繁体   English

Mac PackageMaker:仅当文件不存在时才执行操作

[英]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? 也许在安装前检查中使用了Apple脚本?

Thanks in advance for your help 在此先感谢您的帮助

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM