tags:

views:

171

answers:

3

I have a C project in Eclipse that stores its files in two directories at the same level along with a bunch of other stuff that I do not need to have in the project.

/path/
     /code_I_want
     /bad_stuff/
     /more_code_i_want/
     /huge_pile_of_other_code/

Edit: The source directory is a Clearcase VOB mount point so I can't control what ends up there.

+2  A: 

Try this:

Project > Properties > Java Build Path > Source > Add Folder

jdigital
will this work if I am not using any builder and its not a Java project?
Arthur Ulfeldt
Good question, I must have missed the "C" part. I haven't used C projects in Eclipse but I suspect that there will be a similar option.
jdigital
I'm not finding anything that will let me add a path under the C++ builder options.
Arthur Ulfeldt
+1  A: 

New --> File --> Source Directory or Folder.

If you don't want files in the project, don't import them into eclipse and eclipse won't/shouldn't display them.

I should have included that its a clearcase vob and i dont import anything because importing into eclipse breaks clearcase plugin.
Arthur Ulfeldt
cant add a directory that is not already under the project root.
Arthur Ulfeldt
+1  A: 
  1. Create a new C project in Eclipse. You can give it its own directory at some arbitrary location in the filesystem, or you can point its folder at code_I_want or more_code_i_want.
  2. Go under File, New, Folder. Click the Advanced section and click "Link to folder in the file system." This creates a virtual folder within your Eclipse project (similar to a symlink, if you're familiar with Linux / Unix) to whatever path you specify. Use this to make code_I_want and/or more_code_i_want into virtual subdirectories of your Eclipse project.
  3. Notice the Variables button there under the Advanced section? That can be used to help create relative paths. (For example, each of our developers sets a per-user variable called APP to point to their local working copy, then the Eclipse project settings can be shared between developers regardless of where they keep their working copies.) To define variables, go under Windows, Preferences, General, Workspace, Linked Resources.

Edit: Or you can just create symlinks.

Josh Kelley
im running linux btw. the symlink solution should work great!
Arthur Ulfeldt
I meant that you can use Eclipse to set up something like a symlink (and updated my answer accordingly). But you're right, symlinks are a good, simple solution.
Josh Kelley