Convert a non-project directory within a project to a sub-project in MKS? - mks-integrity

I've got a project in MKS Integrity (not my choice...) that has numerous sub-directories, not sub-projects. Is there an easy process or method or command to convert all sub-directories into sub-projects?

This is easy, but could be involved, depending on your situation:
Suppose you are using Integrity 10.4, and in your sandbox you have a subdirectory named "alpha":
Select all the members in the "alpha" subfolder (I think this works in the sandbox, as well).
From the menu, choose Member -> Move.
Hit Next >.
In the "Move Members Wizard" dialog, note the "Source Sandbox Name" and "Destination Sandbox Name" are the same.
In the destination directory dialog options, add the subdirectory name "alpha" (the name of the current subfolder)
Set "Create Subprojects" option (hit Options >> to show the options).
Accept the changes by hitting Finish.
This should create a subproject with the same name as the subfolder.
Disclosure: I work for PTC Integrity Support.

Related

Changing Xcode 5 settings for folders added to project

When adding a folder to Xcode project there are two options - "Create groups for any added folders" and "Create folder references for any added folders."
My question is that if there is a way to change these settings once the folder is being added. I know we can remove the folder from the project and re-add them, but I wonder if there is some other way that is less idiotic to accomplish such task.
What you're asking for doesn't make much sense.
A group (yellow folder) in Xcode is just an abstract organizational concept. A group can contain one or more resources that actually get referenced/compiled/copied, but the group itself is just an placeholder that doesn't (necessarily) have any relation to the filesystem or target bundle.
A folder ref (blue folder), on the other hand, is the exact opposite. The folder itself is the only thing referenced/compiled/copied by Xcode and its contents are just blindly copied or whatever along with it. Xcode doesn't notice if you add, remove, or edit the contents. It only cares about the folder.
Because they are functionally opposite, converting from one to the other in-place would end you with a pile of conflicts at best and lost data at worst. So Xcode doesn't provide that as an option.

Standard way to rename xcode project

After I create a project name for example Proj11, I'd like to change the name to Proj12.
So I use Project->Rename, then the name of the project to Proj12
But the project still contains several folders name Prlj11, and after I change the folders' name, the project can't been loaded.
So what is the standard way to rename my project as well as folder name.
Click on the project folder (blue folder with your app name on the top of the project navigator). Pull up the utilities (right pane), then file inspector. Your project name is there, change it to whatever you want. Then it will ask to save, keep all the files it selected for you selected, then press rename
The best answer I found was on the apple developer site. Imagine that? You can follow the link below, but essentially it is:
1) click on the target in xcode, on the right in "Identify and Type" under name change the name and press the ENTER button on your keyboard.
2)a window will appear confirming the change and what it will change. Once you confirm it will make the changes.
https://developer.apple.com/library/ios/qa/qa1625/_index.html
OR ANOTHER WAY AND EVEN EASIER:
left-click on the name project and rename. As soon as you rename it will ask you if you want to rename:
The folders you see in XCode navigators are not an actual folder/directories, these are virtual folders only to group your files.
And the folders you see in Finder, the path you manually set for the project, you need to rename them manually.

Folders not showing up on disk from XCode

I added a folder to my project in XCode and called it Themes, which will be used to store themes for my iPad app. Under that I have Red,Blue, and so forth.
They show up in XCode. But when I look at the physical folder, there is no Themes directory (and obviously anything under it).
Why not? Where did it go? How can I store images (which may have same names) under different paths (themes)?
Thanks in advance
XCode does not create "folder", it creates "groups". Groups are logical organization of your files, independent of the file system organization underneath it
If you want to actually have a folder, easiest way would be to create one on the file system first (through Finder), and then drag it to XCode's project navigator. When a confirmation window pops up, leave the default settings ("Copy items into destination" and "Create groups for any added folders")
This will import the folder and all the files in it, however it will not auto-import newly added files to the folder after this (you'd have to manually add them).
If you do want to auto-import newly added files from the file system's folder to this group in XCode, instead of using "Create groups for any added folders", change to "Create folder references to any added folders"

How should I organize my Xcode project files?

I'm trying to wrap my head around Xcode's file organization - or lack there of. I can do all I want in project and it looks great with all the "fake" folders and structure. I go look at the file system and boom HUGE mess. I've tried importing files with the Create Folder Reference for any added folder option checked and that works, kinda. I get the structure I want both in Xcode and on the filesystem.
Issues: When I add a file to a folder on the filesystem that is a Folder Reference in Xcode, its not in Xcode when I go look, not even after reloading the project. Files/Subfolders in a Folder Reference can't be moved around in Xcode. When I move them on the filesystem I get red links (can't find the file?) in Xcode.
How do I keep a organized project and filesystem? How can I set up a project to just recognize a folder and show its (current and up-to-date) files and subfolders in my project?
Another issue I seem to run into, if I use a Folder Reference and change a file, the file is not updated in my application unless I do a full clean & rebuild. If I don't use a Folder Reference, all my files are dumped into the Resource folder of the application bundle, not in the nice structure I have in my project.
Should I care at all? Should I just use the fake folders and let everything go everywhere and not care? My application bundle will be a mess, the filesystem will be a mess, but it will all work... I would hope?
Edit:
My biggest reason for wanting an organized filesystem is that the resource files (images, sounds, other datafiles, etc.) are not edited in Xcode. I have to access them in 3rd party apps via the filesystem. If its a mess things are harder to find and maintain in the other 3rd party applications.
Also what happens if I want a structure like the following:
Images/Backgrounds/Name.png
Images/Icons/Name.png
Images/Titles/Name.png
Should I use long filenames rather than folders to organize?
Images_Backgrounds_Name.png
Images_Icons_Name.png
Images_Titles_Name.png
I also wish Xcode automatically kept itself and the file system in sync.
So much so, that I spent an hour doing so manually for a project called acani-iphone on GitHub. Basically, I just moved some of the files around using Finder, creating new folders as I pleased. Then, I switched back to Xcode and saw that the files I just moved were now red (because Xcode was thinking they're where I moved them from and so couldn't find them).
UPDATE: I just figured out that I could've then just clicked on the red group or file, pressed CMD+i (Get Info from the context menu, which you can open by right-clicking on the red file or group), and under the General tab, clicked Choose, then found where I moved the file to in the filesystem. But, I didn't do that, here's what I did instead, which also works:
Then, I just highlighted all the red files in Xcode and pressed command + delete to delete the broken (red) references. Then, I right-clicked on the Group I wanted to add the files to (usually the same group), and clicked Add > Existing Files.... Then, I found the same files in the new spot on the file system. I kept "Copy items into destination group's folder (if needed)" unchecked, I checked the radio button "Recursively create groups for any added folders," and I checked add to target acani if the files I was adding were being used to build the acani iPhone app.
I did the above with like a directory of files at a time. A few times I was more aggressive, adding multiple directories at a time, since I almost always selected the radio button "Recursively create groups for any added folders."
I found out that the files acani_Prefix.pch and acani-Info.plist had to stay in the root file system dir (although there may be settings you can set to allow these files to be elsewhere, like I think you can add a line to acani-Info.plist so that you can move/rename acani_Prefix.pch, but I'm fine with them in the root dir on the file system.
That was annoying to do, and perhaps not even worth the trouble, perhaps procrastination, but going forward, before adding existing files to Xcode, I'll first make sure they're in the place I want them to be on the file system.
OK, so here is how it works:
Xcode doesn't know about any files until you tell it about them. That is, even if you add a file manually in the finder (usually a bad idea) to a folder that contains files in an Xcode project, it doesn't know about them until you "add existing file to project".
The best practice (imo) for adding an existing file (or group of files) to a project (say, some code you just downloaded) is to choose "add existing files" and then "copy items to destination group's folder (if needed)" in the next dialog, if you want your project to have a copy of the files in question, rather than merely a reference to them (there are advantages and disadvantages of both).
Don't worry too much about the naming of folders in Xcode, or where you put things, but try to keep to a standard that makes sense in your environment. For example, I always put the classes I write in "Classes", and have separate folders for any library code i've downloaded for use in the project. I always put images/icons/audio etc in to "Resources".
In short, if you like what's in the project folder to be approximately the same as what's in your project, always add existing files by choosing the "copy items to destination group's folder"
The flexibility in XCode is intentional. It's up to you to decide how you like to organise things.
Should I care at all? Should I just use the fake folders and let
everything go everywhere and not care? My application bundle will be a
mess, the filesystem will be a mess, but it will all work... I would
hope?
IMO no... :) basically. The whole point is that XCode has been designed to give you the best experience of programming. If Apple wanted you to physically organise all your files and folders within the actual filesystem then they would have made it that way.
I don't really understand why you would want to organise all the files and folders in this way anyway? It makes no difference to the running of the application and the "fake" folders (groups) in XCode adequately provide the necessary visual aid for yourself (and others) to navigate through your classes and other resources. Organising it correctly in your filesystem (as you have found) surely just makes things more difficult?
Use Synx.
It rearranges your files on disk to match your Xcode groups. I try to run it before committing any code that changes the Xcode groups, and it keeps the project nice and tidy.
It would be great if Xcode could keep itself and the file system in sync. Unfortunately it doesn't. One reason for wanting it to is so the hierarchy in your SCCS matches the one in Xcode.
I fall back to keeping things organized in Xcode, and leaving the file system separated into not much more than "Classes" and "Resources".
This changed with Xcode 9. From the release notes:
Groups in the Project Navigator are now more closely associated with
directories in the file system. (28612132)
Dragging files between groups in the Project Navigator moves the files in the filesystem and updates any associated SCM working copies.
When a group is connected to folder in the filesystem, creating, renaming, and deleting groups updates the corresponding files and
folders in the the filesystem.
To remove a connection between a group and a folder in the filesystem, select the group, and then open the File inspector and
click on the on the Clear path button (X).
To add or update an association from a file or a folder in the filesystem to a file or a group in the project, select the file or
group, open the File inspector, and drag the corresponding file or
folder onto the Location section in the File inspector.
The new behaviour is available from the 'New Group with Folder' command (which may appear as just 'New Group'), while the old behaviour is available from the 'New Group without Folder' command (which may also appear as just 'New Group'!) The dominant usage amongst any existing groups in the target folder seems to determine which command gets labelled 'New Group'. It's more than a little confusing, but if you are in the habit of choosing one or the other, the idea seems to be that you can just stick with the default 'New Group' command. (See rob mayoff's far more thorough explanation.)
What I do is create a group to represent each folder and then, before adding files to it, in the right panel, first tab, immediately below "Path", there is an icon that allows you to choose the folder. In that folder dialog, I create a folder that matches the group and choose it.
In xcode3, this resulted in new and add files dialogs starting in this path. That made it worth the effort. Xcode4, however, does not respect this setting. Therefore, its questionable whether there is any real value in it. I also wish XCOde would support better file system organization.
Considering that file names must be unique within a project, regardless of groups and folders, there is justification for accepting the flat folder structure default and using groups for IDE convenience. Its difficult to come from other platforms where this is frowned upon.
i feel you and personally cannot NOT care about the actual structure and just rely on workspaces.
what would be really great is a tool that will go over the workspace structure and re-organize the file system accordingly, taking care of any re-naming of folders etc. this would be a classic solution and IMHO should be implemented as an option as we re-organize our project as we move about it.
some issues could be source control though xcode4 works with both git and SVN.

Borland Starteam incorrect files status

I have some project saved in starteam. As there are a lot of obsolete files I can't check in or check out all project, only changed files. Now I copy project from one computer to another for other developer. I expect starteam treats copied project as new item for check in and check out, but it don't.
Forexample:
I modified file on first computer.
I update list of files on second computer and see this file in "check in" list, as I modified it on second computer.
It is incorrect.
I think there is some configuration file or something like, that saves computer (or user) settings. So when project is copied, settings is copied too.
Do anybody know how to change this configuration to set copied project as new instance of starteam???
You should be able to Right-Click on either the file or a close group of files (such as the Modified group) on the file tab within a project and choose the Update Status option. This will cause StarTeam to analyze the file to try to determine if they truly are the same as what is in source control. Then you can refresh the list and it should change most of your files to current.
There is also a configuration setting under Tools->Personal Options->File tab that is "Use file checksums (MD5) to calculate status". This may be useful to you as a different way to have StarTeam determine if the file on your local disk is the same as what is in source control.
It sounds like you are using a custom filter/query for your check-in list. The status for the files that are copied/moved would be "unknown" and they can still be checked-in by checking the "force check-in" checkbox in the check-in dialog. Just verify that the local version is correct by using compare contents before committing it.
You can try switching from a central file status repository to a "per folder" repository. This will create .sbas folders wherever you check-out files and should maintain status for local files when their containing folder is copied or moved. Look under Tools, Personal Options on the File tab under Repository.

Resources