如何让 Xcode 在磁盘上的文件夹结构中复制项目组结构? [英] How do I get Xcode to replicate project group structure in the folder structure on disk?

查看:26
本文介绍了如何让 Xcode 在磁盘上的文件夹结构中复制项目组结构?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有以下组结构的 Xcode 项目:

I have an Xcode project with the following group structure:

ProjectName/
    Classes/
        class1.h
        class1.m
        class2.h
        class2.m
        ...
    XMLDocs/
        doc1.xml
        doc2.xml
        ...
    Resources/
        Info.plist
        MainMenu.xib
        ...

等等等等.

我也希望在磁盘上的文件夹结构中显示此内容:

I'd like this to be represented in the folder structure on the disk as well:

ProjectFolder/
    Project.xcodeproj
    Classes/
        class1.h
        class1.m
        class2.h
        class2.m
        ...
    XMLDocs/
        doc1.xml
        doc2.xml
        ...
    Resources/
        Info.plist
        MainMenu.xib
        ...

与根项目文件夹方法中通常的所有内容相反.

as opposed to the usual everything in the root project folder methodology.

有什么方法可以做到这一点,而无需在磁盘上手动创建文件夹结构,然后将 Xcode 中的所有引用重新指向新位置?

Is there any way to do this without manually creating the folder structure on the disk and then having to repoint all the reference in Xcode to the new location?

如果您能告诉我如何在 Xcode 中创建新组或将文件添加到现有组时自动执行此操作,则可以获得奖励积分.

Bonus points if you can tell me how to do this automatically any time I create a new group or add files to an existing group in Xcode.

推荐答案

Xcode 中没有让我的磁盘看起来像我的项目结构"功能.

There's no "make my disk look like my project structure" functionality in Xcode.

不过,您可以使用 AppleScript 自动执行任务:您可以通过脚本检查和更改项目结构.因此,您只需要编写一个脚本来遍历项目结构并使文件夹层次结构看起来像项目结构那样,并同时调整 Xcode 的文件和组引用指向的位置.

You could automate the task using AppleScript, though: You can both examine and change project structure from a script. So you'd just have to write a script that iterates over the project structure and makes the folder hierarchy look the way the project structure does, and adjust where Xcode's file and group references point at the same time.

这篇关于如何让 Xcode 在磁盘上的文件夹结构中复制项目组结构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆