Unable to rename a group folder in Xcode - xcode

I added a new group from selection today in Xcode containing several files. For some reason, this has consisted for a while, I am unable to name or rename the group folder.
Has this happened to anyone else before, if so have you come across a fix?

What have you tried to do in order to rename it?
The contextual menu (right click) does not provide a rename option. Therefore I either
Select the group
Hit return which selects it for editing
OR
Select the group
After a short delay (long enough to not count as a double click) click it again

Sometimes it happens.
Workaround:
Quit Xcode.
Launch Xcode.
Tada

For anyone that has my issue: Check your files in Finder. I had a folder that was already using that name. Delete that folder and it will allow you to change name.

You cannot rename the folder probably because that folder already exists in that directory.
To solve it:
Select the folder you want to rename, press the right button, press show in finder.
Delete the folder(s) that already have the name you want.
Go to Xcode and try again.
Good luck :)

Some times its not related to xcode, its finder problem, because directory still exists and finder doesn't show that, you can see directory exists by entering ls in terminal.
How to solve this?
Open terminal and navigate to parent directory of desired directory : cd ~/../parent or just right click parent directory and choose New Terminal at Folder
Remove desired directory : rm -rf MyGroup
Now you can try to create your group with MyGroup name.

Related

Accidentally created a file in Git Bash with touch that can't be deleted, modified, read, or moved (Windows 10). How do I get rid of it?

So I submitted a line on Git Bash "touch README.txt -m '...asdf ... qwer...' " attempting to create a readme file with text inside (I'm obviously new to this haha). The result was an empty README.txt file and a random file titled '...asdf ... qwer...' with filetype "file" that I can't get rid of. When I try to delete or alter it, a window pops up that says "Could not find this item. ... This is no longer located in [location]. Verify the location and try again." The Git GUI doesn't seem to recognize it either and I can't delete the parent directory. Command line deletion (del /r /q "...") was unsuccessful. Tried rebooting as well to see if it disappeared. It is not a hidden file.
What exactly happened here and how do I get rid of it? Thanks!
I had a similar issue trying to delete a file that "no longer existed" on my Windows 10 PC. What worked for me was adding the problem file(s) to an archive and ensuring the option, "Delete files after compression" (or equivalent option) in the archive software was ticked. Once the archive process completed, the problem file disappeared from the folder. I then deleted the archive file and everything was good to go.
To add the file to an archive make sure you have something like 7-Zip or WinRAR installed. Here's an example using 7-Zip:
Right-click the problem file and select "7-Zip" from the context menu followed by the "Add to archive" option.
In the "Add to Archive" dialogue, tick the "Delete files after compression" option.
Select the OK button.
The problem file will disappear and an archive file will appear in your folder in its place (hopefully!).
Delete the archive file.
Hope this works for you too.

Can I make a file that I create at runtime to appear in the contents of Xcode project?

In Xcode, when I fopen a file that doesn't exist in my computer, you can see it created in the directory you choose, but it won't show up in the contents in the left of Xcode. How can I make it show up in the Xcode once I create it?
You need to create a so-called "Folder reference" to your output folder.
Xcode has two kinds of folders in a project tree:
Group references
Folder references
The difference is explained for example here: Difference between folder and group in Xcode?.
When I use C function "fopen("test.txt", "w+") create a new file "text.txt", it will appear in my directory of main.c, but it won't show up in the left content(project navigator), I mean how I see the "text.txt" appear in the content once I create it, but not add it manually? – 李梧畅 yesterday
For single files Xcode only supports "Group references" which means that a file will not appear automatically if you create it in the physical folder. So you have only two options:
Create a "Folder reference" and create your file to that folder as I demonstrate with screenshots below.
(stupid, not recommended) create empty file add it as "Group reference" via "Add Files" and then delete the file. In this case you will have your file in Xcode but it will be red if the file does not exist.
Below are the steps needed to accomplish this with screenshots:
In the file system, in the folder where your main.c is located, create a folder of given name like Output.
In Xcode right-click on your folder practice_io, click "Add Files to ...".
Select 'Output' folder. Also click Options, where select "Create folder references", click "Add"
You will see blue folder "Output".
In your C program make your file to be created in Output directory
When you run you C program, the file will be created in that folder and Xcode will see it.

Set global working directory alias in Git bash (Windows)

I've been trying for literally hours to set a global alias that I can use when I open Git bash on my Windows machine to cd to a specific location.
I want to be able to simply type the alias to get to the location. I've tried every which way. The attempt that got me closest was based on this: https://superuser.com/questions/602872/how-do-i-modify-my-git-bash-profile-in-windows
...but it seems that to get it to work upon relaunching of bash, I have to use source .bashrc, which I don't want to do. Help appreciated.
I just jury rigged a solution with a simple shell script that acts like a global alias. If someone has a better solution, please do tell.
Opened text editor and wrote the following two lines:
#!/bin/bash
cd blah/blep/directory_of_choice
Saved it as a text file with a descriptive name (like dirjump) somewhere and copied it.
In file explorer, navigated to the bin folder in the MinGW64 installation, e.g. "C:\Program Files\Git\mingw64\bin"
Pasted the file into this bin folder.
While viewing the contents of the bin folder referenced above in Windows file explorer, from the menu bar selected "view > options", which opened the "folder options" dialog. Selected the "view" tab here and unchecked "Hide extensions for known file types" and clicked ok.
Deleted the ".txt" extension from the file copied into the bin folder.
To call this shell script that has the same result as a global alias, typed the following in Git bash:
. dirjump (the space between the dot and the dirjump MUST be included)

Applescript folder actions support for changed / altered / updated files?

Does the folder action for when a folder item is changed not exist? I want my script to run when and if I update a file. I don't see any reference to it in the documentation. Is there some sort of alternative I am missing because this seams pretty crazy to not have.
on adding folder items to this_folder after receiving added_files
do shell script "anything"
end adding folder items to
on removing folder items from this_folder after losing removed_files
do shell script "anything"
end removing folder items from
-- does not exits?!?
on changing folder items in this_folder after updating changed_files
do shell script "anything"
end changing folder items in
Nope, doesn't exist directly. However, something similar could be accomplished with an idle handler that watches the files in the folder to see if their modification date has changed and perform an action on files where that's true.
There is an alternative to folder actions. You use launchd and setup a watch path. With a watch path, any time something changes in the folder you are watching, your code runs. The biggest difference between folder actions and the launchd action is that with the launchd action you don't know which files changed. You just know something changed. So your code has to figure out what the change actually was, but that shouldn't be too difficult in your case because if you're looking for an updated file you just check the modification date of the files.
You can google for launchd and watch paths if you want to try it.
What about rsync -va '/source/path/' '/destination/path/', using Lingon, have this simple command set as an user Daemon to run, say, every 10 sec?
I found a tricky way to do this with Automator easily and works only in some cases so try it and see if it helps. When you create/modify a folders contents in OSX a hidden OS file called .DS_Store gets written to the folder, its a useless file to a user but it can trigger the folder action. With that said, I use rsync in a Run Shell Script action in my folder action. Once the action is done syncing I then remove the .DS_Store file.
Here is my example:
rsync -r /Users/path/to/source/* /Users/path/to/destination
rm -f /Users/path/to/source/.DS_Store
Then the next time you modify files/folders in that directory, the folder action kicks in and the process would repeat.
I hope this helps...

Trouble deleting .svn folders in Vista

I do a search on .svn using Explorer in my project directory and they come up fine. But when I try to highlight all the .svn folders in my search results it appears that they are deleted by the dialog but they're stil there. I can't get rid of them!
Why do you want to delete the .svn folders in a working copy?
If you want a "clean" copy of any given tree version, you can easily use SVN Export (available from the Tortoise SVN menu).
Try doing it from the cmd line
I think...
del /F /S *.svn.
You can drag the versioned folder to the destination folder using the right mouse button and when your mouse pointer is over the desired drop location let the button go and select the "SVN export all items here" option from the context menu that pops up. This should copy over both the versioned and unversioned files without the .svn directory. I hope its not some additional application that I installed that gives me this option but maybe you should try it.

Resources