clion: exclude files from project view - clion

My Project View in CLion lists not only C++ files and headers but also built libraries (.la) and object files (.o). I don't want to see them. What can I do to make them not appear in the list?

In the menu go to Files/Settings: in the dialog box chose the item File types. The last field in the dialog is Ignored files and folders. It contains semicolon-separated patterns that will be applied and, if the file matches one of these, ignored. Wildcards like * are allowed.
So just add ;*.la;*.o at the end.

You can also define a so-called "Scope" by clicking on the gear icon at the right of the project view's header bar -> "Edit scopes". This will present you with a nice ui to define your filter. Afterwards, click on the triangle next to "Project" in the project view header bar and select your newly created scope.

If you are using version control(git) you can also add the file extensions to the .gitignore file and Clion should hide those files as well. If you're not using version control then adding the file extensions to the Clion Ignored files and folders list.

Related

show hidden files and folders in project drawer in textmate

By default, textmate does not show all files and folders in the project drawer.
how do I make textmate project drawer show hidden files, in particular all files and directories beginning with a dot?
Click Preferences > Advanced > Folder References,
Edit File Pattern (minimal change to original default):
!(/\.(?!\W*)[^/]*|\.(tmproj|o|pyc)|/Icon\r|/svn-commit(\.[2-9])?\.tmp)$
as well as Folder pattern (minimal change to original default):
!.*/(\.(?!\W*)[^/]*|CVS|_darcs|_MTN|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$
This only applies to new project folders. For an existing one, you need to edit the pattern after right-clicking on folder reference and choose Show Information.
7 years later, TextMate (v2.0.6) , shows these options:
default "Exclude files matching":
  {*.{o,pyc},Icon\r,CVS,_darcs,_MTN,\}arch\},blib,*\~.nib}
default "Include files matching":
  {*,.tm_properties,.htaccess}
Non-text files:
  {*.{ai,bz2,flv,gif,gz,icns,ico,jpg,jpeg,m4v,nib,o,pdf,png,psd,pyc,rtf,scssc,swf,tar,tbz,tgz,tif,tiff,zip},Icon\r}
To show all hidden (MacOS) files+folders in file-browser pane of TextMate, what needs to be changed ?
goto TextMate > Preferences > Projects:
change the "Include..." box regex code into this:
  {*,\.*}
as shown in below:
#Viktor Tron's answer is perfect... Just wanted to add this comment (but had a picture, so I'll add this answer)... Once you DO show "invisible" (.dot) files via his snazzy regex... you may want to weed some otherwise extraneous files that now clutter your projects hierarchy... Just do it via the specific project folder's "Show Information..." contextual menu...
In this example I want to IGNORE (fucking) .DS_Store files.. SO I simply add !\.DS_Store to the "File Pattern" section.

How to delete user-defined build settings in Xcode 4.3.1

I have created several user-defined build settings in Xcode 4.3.1. I no longer need these settings and want to delete them, but there doesn't seem to be a way to delete them!
I am aware that these are stored in the project settings (project.pbxproj) file located within the xcodeproj file. But I don't want to edit these in a text editor as there are all sorts of repetitions and guids which I don't understand.
Any suggestions on how I can do this within Xcode? (or have they forgotten to add a "delete" button)
Just figured this out myself: you need to make sure you're at the right scope to be able to delete the setting. If you defined the setting at the project scope, no amount of key-bashing will remove it if you're looking at the target-scope. Remember, targets inherit settings from project scope. That last bit is what I tripped over :)
Try selecting a user-defined setting that you created then hit "Delete" button on your keyboard. That works for me when I encountered the same problem.
On Xcode 6:
Select the row and hit Fn + Delete.
Follow the steps below:
Select Project
Tap on the Info tab
Select Configurations
Select Configuration to remove
Press the Delete button on the keyboard
Removing User-Defined build settings depends on where those settings have been created.
Lets assume that you've created one already and named it as PROJECT_SETTING. In order to check your PROJECT related User-Defined settings, you have to select your project first on the project and targets list, then you should see something like this:
Here you can see only PROJECT related settings, and here you have the
only ability edit/delete PROJECT_SETTING.
Besides that if you set up a TARGET, so can add new User-Defined settings there, that only affects that TARGET scope.
You can edit/delete TARGET_SETTING_1 and TARGET_SETTING_2 here, but
PROJECT_SETTING is read-only, as it is inherited from your
PROJECT settings.
Here you will notice that your TARGET contains your PROJECT User-Defined settings and also your TARGET related User-Defined settings marked as bold letters. This helps you to know which setting can be edited on this level.
You won't be able to delete your settings here if that was created under PROJECT scope, and also editing a PROJECT related User-Defined settings will result a newly created settings that affects only the selected TARGET.
Also if you prefer more visibility on Build Settings, you can select Levels view instead of Combined view, so you should see it more separated:
Select one of them and press keyboard's delete button.
There's a caveat to these answers: If you're using a Build Configuration File (.xcconfig) it doesn't seem possible to delete the user-defined settings generated from these files directly on either the project or target level in the "Build Settings" GUI. You'll have to delete the flag and its value from the configuration file and rebuild the project. If you're using multiple build configuration files that use the same flag, you'll have to delete them from each file.
Although settings that come from these configuration files are displayed in the User Defined build settings section (just like any other user-defined flag that one would create from the GUI), they are not written to the .xcodeproj file like the settings that one adds from the GUI are (which probably prevents them from being able to be deleted from the GUI). They are also not displayed in bold text like these GUI-added settings are.

Adding classes in Xcode

I'm new to Xcode and have a set of instructions for a library that I need to import.
The documentations says:
Please add X.h and X.m into project by clicking Classes, Add and
Existing Files.
Q: Where is the "Classes" menu?
There is no "classes" menu per-say.
You want to right click(or CMD + Click) on the folder containing your actual project visible in the left pane of XCode 4(The Project Navigator, or CMD + 1) and add existing files.
Alternatively, you can also go through Files -> Add Files to "Project". Then select your files.
Regardless of how you do it, make sure to check the box that says "Copy item's into destination groups folder. (If Needed)"

How to exclude image files in Xcode project bundle, conditionally for Release version?

I added .png images to the Xcode project for conditional use like making screenshots of a view
However, since this is not needed for the Release version of the app, I would like to find a way to exclude them using some kind of settings for Target. I expect there can be a solution like using #if DEBUG macro for Debug compilation, which can work for lines of source code. But, in case of files included in project bundle, I am having trouble finding the answers.
In Xcode 3, there's a view above the editor that lists the files in the project. There's a checkbox on the right side of that view for each file, and you can uncheck the box to remove the file from the current target.
In Xcode 4, show the Project Navigator on the left side of the window, and show the File Inspector on the right side, in the Utilities area. When you select a file, you'll see a Target Membership area with a list of targets and checkboxes. If you want to exclude the file from a particular target, uncheck the box next to that target. Here's a picture:
This is a bit different from excluding files from only some builds of a single target. Still, I think it's the simplest mechanism to use for the situation that you describe. Simply duplicate your existing target so that you have a copy that you can use for making screenshots. Remove the extra files from your production target but leave them in the screenshot target, as described above.
A target's inputs are the same for all builds, so there's no checkbox that will do it for you.
All that really happens though is that image files like .png or whatever get added to the copy bundle resources phase. You can remove them from that phase and instead create a custom script build phase using a shell script.
It will default to printing out all the environment variables set by xcode, from there you should be able to write a script which only performs the copy when say ${BUILD_STYLE} is 'Debug'.
You probably want ${BUILD_STYLE}, ${CONTENTS_FOLDER_PATH} and ${INPUT_FILE_PATH} for starters.

Adding an existing implementation file to an Xcode project won't work

As I write most of my code using MacVIM, I need to add the new files to the XCode project in order to compile them into the executable. Today however I encountered an implementation file (.m) which XCode won't allow to be added. It appears light gray in the appropriate finder window as if it were already included in the project, but when I try to build, I get a linker error, stating that the symbol defined this implementation file could not be found. The corresponding header file could be added without problems.
Any idea what could have caused this problem?
Btw. I deleted a former version of the same file from the "Classes" tree before, as well as many others which were successfully re-added.
I think I saw a similar problem once with an old version of Xcode. IIRC the way I resolved it was to:
rename the source file (temporarily)
add the renamed file to the project
do a "Save As..." on the renamed file to get it back to the original name
The file is probably already in your project, but not in the target you're building. Use the Detail view and Search bubble to find it, Get Info, and in the Targets tab of the info window, check the check box for the target you're building.
The other answer (removing and re-adding) works because you end up removing it from the project, then when you re-add it, it's added to the current target by default.
I found that deleting my pbxuser file from inside the .xcodeproj solved the problem for me. There were references to the files I couldn't add in there, surprisingly. This has happened to me many times over the years.
Another trick is to:
Move the file into a different directory
Add it to the XCode project from there
Move it to the desired location
Select the file in Groups & Files
Choose File > Get Info from the menu bar. The full path will appear in red.
Press the Choose... button and select the file at the new location.
If you are using Xcode 4, you can do the following steps to add an existing file into your target:
1) Select your file in "Project navigator" view (aka. click your myfile.m file in the folder tree of Xcode)
2) Click menu item "View" => "Utilities" => "Show File inspector" (or use the shortcut "Alt + Command + 1)
3) There is one section called "Target Membership", check the target you want
I fixed this by deleting the .xcuserstate file and restarting the project. I am using a workspace file, for all it's worth.
You can find any and all referencing files via
grep -r -h [NameOfFileThatYouAreTryingToAdd] *
from within your project directory.

Resources