applescript 将文件夹复制到 Xcode 中?
我在使用 AppleScript 将文件夹复制到 XCode 项目时遇到一些问题。如果没有 Applescript,我将文件夹拖到 Xcode 中。
我使用了类似的 Applescript 处理程序(如下所示),使用“wrapper.library”作为文件类型将库复制到 XCode 中。下面我使用“wrapper.folder”尝试将文件夹复制到 XCode 中,但它不起作用。
on addFolder(fname, fpath)
tell application "Xcode"
tell project "Unity-iPhone"
set my_targets to targets
set s_target to item 1 of my_targets
set compile_phase to compile sources phase of s_target
set link_phase to get link binary with libraries phase of s_target
tell root group
set a to make new file reference with properties {full path:fpath & fname, name:fname, file type:"wrapper.folder"}
add a to link_phase
end tell
end tell
end tell
end addFolder
有谁对我缺少的内容或如何编写 Applescript 将文件夹复制到 XCode 有任何想法吗?
I'm having some trouble copying folders into XCode projects with AppleScript. Without Applescript I drag the folder into Xcode.
I've used a similar Applescript handler, as the one shown below, to copy libraries into XCode using "wrapper.library" for the file type. Below I am using "wrapper.folder" to try to copy a folder into XCode and it isn't working.
on addFolder(fname, fpath)
tell application "Xcode"
tell project "Unity-iPhone"
set my_targets to targets
set s_target to item 1 of my_targets
set compile_phase to compile sources phase of s_target
set link_phase to get link binary with libraries phase of s_target
tell root group
set a to make new file reference with properties {full path:fpath & fname, name:fname, file type:"wrapper.folder"}
add a to link_phase
end tell
end tell
end tell
end addFolder
Does anyone have any ideas on what I am missing or how to write an Applescript to copy a folder into XCode?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它对我有用:
Xcode 4 的代码有点不同
“如果需要,复制到目标文件夹”选项只需将文件复制到项目中(如果它们尚未存在),然后对复制的文件而不是原始文件。您可以使用 Finder 或 shell 命令(如 cp 或同上)执行相同操作,然后引用复制的文件。然后我不会使用完整路径而是使用相对路径。使用相对路径将项目移动到另一个文件夹不会给您带来任何问题。
It is working for me:
The code for Xcode 4 is a bit different
The option 'copy to destination folder if needed' just copy the files to the project (if they're not already in there) and then make a file reference to the copied files instead of the original files. You can do the same with the Finder or a shell command like cp or ditto, then make a reference to the copied files. Then I wouldn't use full path but relative paths instead. With relative paths moving the project to another folder won't give you any problems.