I forgot to select option of 'Copy items into destination group’s folder' while adding files from a different project - xcode

I copied files from an old Xcode project and used it in my current one. I made a lot of changes in my current project, including in the files copied from the old project. Now I can't run them on another computer without including the old project.
Is there any way I can separate them now ?
I don't want to delete the files and add it again in the project.

Save a copy of the files in their current state. Then remove the references to the files in the new project. Now add the copies you saved off (and choose to copy them). Once done you can delete the copies you made earlier.
But keep in mind that this leaves the files from the original project with all of the changes you have made. Unless you have made proper use of source code control of you have backups, there is no way to revert the files in the old project back to their proper state.

Related

Moving files within codeblocks project

So this might be outright stupid question, but I found no answer looking on the internet or fiddling with different buttons.
Say you have a project with several physical folders which contain different source files. Now you've decided that you'll create a new folder and move parts of three old ones in there.
In order to do so, I had to do the following:
Go into my project folder via explorer and create a new folder
Manually move all the desired files into that folder
Return to code blocks and remove all the moved files from the project
Re-add all the removed files by selecting the whole new folder when adding existing files
Manually going through code and modifying all affected include directives to point to the proper path
It would be much simpler if you could right-click a folder, create a new nested folder and just drag-and-drop files to where you want them while code blocks would move them on disk and correct the includes for me.
It's the way that Eclipse does it for Java. Is there similar functionality for code blocks, maybe a plugin?

How to delete file from TFS and exclude from source control?

I'm working on a project where I'm writing a library. I have a file, lets call it... tester.cs which I use for testing the library. Now, I'm only supposed to check in the library but i accidentally also checked in tester.cs. Is there any way I can delete it from the remote server without deleting it locally? and also ultimately removing it from source control? Thank you in advance.
If you want to delete files on the TFS server and leave them locally. There's the obvious brute-force solution of copying the files to a temporary location, fixing source control, then adding them back in to your project.
And also here is a similar question for your reference: How to delete a file from TFS repository without deleting local file
It depends really on what you mean by 'delete'. TFVC has the concept of delete which flags a file as deleted in the Project Collection database (and removes it from your workspace etc.). And you have the concept op 'destroy' which means the file will be removed from the Project Collection databases, and action that is unrecoverable except by restoring a backup of TFS. But this will leave your local file in place and erase all traces of the file in source control.
However, if you added it to your project in VS (.proj file) then there will be a reference to the file in there as well for compilation etc. This will cause issues when other users perform a Get-Latest of your solution.
Also if you are using a local workspace you can use .tfignore files to prevent such files from being added into the local workspace in the first place. See this page, near the bottom there is some information about the .tfignore file and how they work.
I think it's as simple as making a local copy of a file, deleting it in TFS and moving the local copy back to the original location. Visual Studio does not allow you to do that in a C# project or Source Control Explorer.

TFS/Visual Studio: Move file in the solution without doing an "add-remove"

We recently had to do some refactoring, implicating that we had too move some files.
So in one branch, we did all thoses changes. In the trunk, we continued to work normally, but it appears that when merging, it causes a lot of troubles, since the files appears as removed on the old position and added to the new, making the merge very hard.
What is the correct way to proceed when moving file in the solution?
If you move a file inside a Project that is "bound" to source control, it should be recognised as a "Move" operation, and not do an Add/Delete. If the project isn't bound it might not work correctly.
If you are moving files between projects, you have to unload the Project/Solution and move the files in Source Control Explorer. This can be a bit tedious as you can only move one file/folder at a time*. Then you have to reload the projects and Exclude the files from the old one and Include them into the new one.
*There is an extension that allows you to move more than one file at one called TFS Source Control Explorer Extension.

Force Xcode to update project files

OK, here's my issue :
I'm using Xcode 4.6 under Lion
In my current project I've added several "real" folders (either with sources or with resources) which Xcode represents as "Groups"
However, whenever I add another file in one of my already-imported folders, the file doesn't show up (but instead I have to manually drag each new file to its appropriate location).
Well, given that my project is comprised of hundreds of different files, and that files are being added constantly, this seems like an overkill.
I realize this may have to do with Xcode's Group-centric approach, but it still bothers me.
So, is there any workaround? Any ideas?
As for many IDE, it won't scan changes of new files in included folder, to prevent accidental add of extra codes that will break the compile process. If you really want to do so, write a script to add all files in the folder and run it at pre-compile stage, i.e. in Xcode, "External Target"
See: https://stackoverflow.com/a/976459/188331

When to tick "copy items into destination's group folder (if needed)"

Whenever I am adding some files to my project by dragging and dropping in Xcode, a popup message is shown "Copy items into destination's group folder (if needed)".
I noticed that when we are using most of the third party library's we DON'T tick the checkbox and instead specify the library path in "Header Search Path/Library search Path". But for smaller resource files like images, we tick the checkbox.
Which specific scenarios do I have to tick and what difference will it make?
It all depends on how you want to organize you project. It's far more common to store 3rd party frameworks somewhere on your machine that is independent of any project that may use that framework, thus allowing multiple projects to reference the same shared framework project from a standard directory. In that case, you don't want the 3rd party framework copied into your own project, and so you don't check that box.
Images and other resource files are typically owned on a project-by-project basis, so it makes the most sense to store those in the directory of the project itself. To pull that off, you check that box to make sure a copy is made in the project's directory if one doesn't already exist.
Neither of those rules are absolute, you could copy an entire framework into your project's directory if you want, and you could reference media assets from some standard location. It's all up to you to implement good project organization.
Typically, your project is saved to a project folder. If you drag stuff from outside the folder into your project without copying, only references to the added files are stored. You will have to be careful not to delete them, or your project will break.
Also, if you are using version control, such as the built-in git, files not in the main folder will not get added to your version tree.
I got into the habit of copying everything I need into the main folder and then drag-add without copying. This is working well for me and has so far avoided any errors.

Resources