Xcode组和文件:如何将项目A中的文件复制到项目B而不会发疯?

时间:2023-01-13 21:05:04

For some reason, the representation in Xcode "Groups & Files" does not match the file hierarchy in the folder where all my real project files are. And for some reason, I can't copy a entire group or even single file and put that into another project. So I have a nice hierarchy of images within "Groups & Files", but all thos ordered images are unordered like a big mess in just one giant folder full of stuff on my file system. Really horrible ;)

出于某种原因,Xcode“Groups&Files”中的表示与我所有真实项目文件所在的文件夹中的文件层次结构不匹配。出于某种原因,我无法复制整个组甚至单个文件并将其放入另一个项目中。所以我在“群组和文件”中有一个很好的图像层次结构,但所有这些有序的图像都是无序的,只是在我的文件系统中只有一个巨大的文件夹。太可怕了;)

So now I wanted to put all my icons into another project, but I cant just copy the Group "img > gui > icons". I have to pick every single icon image from my file system, where icons are mixed up with a few hundred other images and files.

所以现在我想把我的所有图标放到另一个项目中,但我不能复制组“img> gui> icons”。我必须从我的文件系统中挑选每个图标图像,其中图标与其他几百个图像和文件混合在一起。

Is there some hidden option I can activate so that Xcode will manage to reproduce the hierarchy of "Groups & Files" inside my project folder on the file system? Or how else could I copy those files?

是否有一些我可以激活的隐藏选项,以便Xcode能够在文件系统上的项目文件夹中重现“Groups&Files”的层次结构?或者我怎么能复制这些文件?

6 个解决方案

#1


3  

It's not really possible to transplant a Groups hierarchy intact from one project to another. Some suggested approaches:

将一个层次结构从一个项目完整地移植到另一个项目是不可能的。一些建议的方法:

  • If the files you want to bring across are the vast majority of the project, just clone the project and delete everything that's not the files you want to copy.
  • 如果要带来的文件是项目的绝大部分,只需克隆项目并删除不是要复制的文件的所有内容。

  • If it's a lot of files in a small number of groups, then set up the groups in the new project, and drag-copy the files from the old project groups into the new project groups
  • 如果在少数组中存在大量文件,则在新项目中设置组,并将文件从旧项目组拖放到新项目组中

  • Write an AppleScript to move the hierarchy across with a recursive-descent algorithm
  • 编写AppleScript以使用递归下降算法移动层次结构

  • ◆◆ Open both project.pbxproj files as text files, and carefully copy the File References and Group References from one to another.
  • ◆◆将project.pbxproj文件作为文本文件打开,并小心地将文件引用和组引用从一个复制到另一个。

#2


1  

Copy icon files in a filtered-Finder window to an "icon-only" folder. Then import them into your new Xcode project. Repeat for any other categories.

将筛选后的Finder窗口中的图标文件复制到“仅图标”文件夹。然后将它们导入到新的Xcode项目中。重复任何其他类别。

#3


1  

Steps: 1.Open up the group in Xcode 2.Select all the items you want to have in your other project 3. Right click and show in finder. 4. Copy those files to a new folder in Finder 5. Now drag and drop those files in the new folder in Finder to your newly created group folder in Xcode on the new project. 6. Accept the copy instructions on 'add file' action in Xcode

步骤:1。在Xcode中打开组2.选择要在其他项目中使用的所有项目3.右键单击并在查找器中显示。 4.将这些文件复制到Finder 5中的新文件夹。现在将Finder中新文件夹中的这些文件拖放到新项目中Xcode中新创建的组文件夹中。 6.接受Xcode中“添加文件”操作的复制说明

#4


0  

Have a look to this other question here

在这里看看这个其他问题

#5


0  

See my previous question here.

在这里查看我之前的问题。

Also, file a bug with Apple to let them know you'd like the option to have groups represent the folder structure on disk.

另外,向Apple提交一个错误,告诉他们您希望选择让组代表磁盘上的文件夹结构。

#6


-1  

I am late, but this is a possibility:

我迟到了,但这是一种可能性:

Open the directory of your project using Finder. Copy whole directory (in Xcode its used as a group) into your new project. In Project navigator, right click and press "Add Files". In dialog box, select copied directory and its done.

使用Finder打开项目目录。将整个目录(在Xcode中用作组)复制到新项目中。在项目导航器中,右键单击并按“添加文件”。在对话框中,选择复制的目录及其完成。

#1


3  

It's not really possible to transplant a Groups hierarchy intact from one project to another. Some suggested approaches:

将一个层次结构从一个项目完整地移植到另一个项目是不可能的。一些建议的方法:

  • If the files you want to bring across are the vast majority of the project, just clone the project and delete everything that's not the files you want to copy.
  • 如果要带来的文件是项目的绝大部分,只需克隆项目并删除不是要复制的文件的所有内容。

  • If it's a lot of files in a small number of groups, then set up the groups in the new project, and drag-copy the files from the old project groups into the new project groups
  • 如果在少数组中存在大量文件,则在新项目中设置组,并将文件从旧项目组拖放到新项目组中

  • Write an AppleScript to move the hierarchy across with a recursive-descent algorithm
  • 编写AppleScript以使用递归下降算法移动层次结构

  • ◆◆ Open both project.pbxproj files as text files, and carefully copy the File References and Group References from one to another.
  • ◆◆将project.pbxproj文件作为文本文件打开,并小心地将文件引用和组引用从一个复制到另一个。

#2


1  

Copy icon files in a filtered-Finder window to an "icon-only" folder. Then import them into your new Xcode project. Repeat for any other categories.

将筛选后的Finder窗口中的图标文件复制到“仅图标”文件夹。然后将它们导入到新的Xcode项目中。重复任何其他类别。

#3


1  

Steps: 1.Open up the group in Xcode 2.Select all the items you want to have in your other project 3. Right click and show in finder. 4. Copy those files to a new folder in Finder 5. Now drag and drop those files in the new folder in Finder to your newly created group folder in Xcode on the new project. 6. Accept the copy instructions on 'add file' action in Xcode

步骤:1。在Xcode中打开组2.选择要在其他项目中使用的所有项目3.右键单击并在查找器中显示。 4.将这些文件复制到Finder 5中的新文件夹。现在将Finder中新文件夹中的这些文件拖放到新项目中Xcode中新创建的组文件夹中。 6.接受Xcode中“添加文件”操作的复制说明

#4


0  

Have a look to this other question here

在这里看看这个其他问题

#5


0  

See my previous question here.

在这里查看我之前的问题。

Also, file a bug with Apple to let them know you'd like the option to have groups represent the folder structure on disk.

另外,向Apple提交一个错误,告诉他们您希望选择让组代表磁盘上的文件夹结构。

#6


-1  

I am late, but this is a possibility:

我迟到了,但这是一种可能性:

Open the directory of your project using Finder. Copy whole directory (in Xcode its used as a group) into your new project. In Project navigator, right click and press "Add Files". In dialog box, select copied directory and its done.

使用Finder打开项目目录。将整个目录(在Xcode中用作组)复制到新项目中。在项目导航器中,右键单击并按“添加文件”。在对话框中,选择复制的目录及其完成。