views:

172

answers:

11

I need a name for them both together. Do they have one?

I want to build a strip"DOT_AND_DOTDOT"() function that gets rid of them ...

+7  A: 

Historically, they are called "dot" and "dot dot". The name for them as an aggregate is "those dots".

John Saunders
this and parent directories maybe?
Aiden Bell
stripThoseDots() :-)
Hannes de Jager
too bad lexers don't understand escaping: strip_\.and\.\.() looks pretty :P
Aiden Bell
stripThoseDots is seriously funny, but not really speaking, sorry ;-)
Barigorokarl
Going for populist?
Joshua
+3  A: 

As far as I know there isn't a name for them collectively.

As "." is the current directory and ".." is the parent directory, you could go for "this_and_parent" I suppose.

ChrisF
+6  A: 

How about strip_meta_dirs() or enum_real_dirs() or a funny one ... notdot_filter_dirs()

Aiden Bell
Ooh, meta directories. I like that.
Richard Szalay
strip_meta_dirs() is short and understandable, I'll take that, thanks! :-)
Barigorokarl
A: 

I'd be interested to see if there's an official name for them, but I'd call them "location markers" or "directory location markers".

Richard Szalay
+2  A: 

They're "current directory" and "parent directory", but I suppose they could be called "intrinsic entries" since they're created in every directory by default.

Ignacio Vazquez-Abrams
+1, logical....
Aiden Bell
And a week later you read the method name and ask yourself "intri-what?"
dbemerlin
A: 

strip_dot_and_dotdot_from_filepath() is immediately understandable to me and I suspect the vast majority of programmers.

Using fancy words sometimes only confuses things.

Richard Harrison
if(i_dont_think_that_a_function_name_can_be_too_big_whereby_its_use_makes_other_code_unreadable()){ use_name(); }else{ too_big(); }
Aiden Bell
@Aiden Bell: I'm not sure that's constructive. This is based on my experience maintaining code where the function name doesn't immediately tell me what it does.
Richard Harrison
It was meant with humour. If it wasn't I would have downvoted.
Aiden Bell
It's been one of those Mondays - so I guess I was probably being over-sensitive. No hard feelings.
Richard Harrison
+1  A: 

It's not their names but . represents the current directory and .. the parent directory.

How about stripParentAndCurrentDirs()?

(I was going to suggest stripDotDirs(), but I'd call a directory like .git a dot directory.)

Frank Shearar
A: 

Since every *NIX system hides every entry starting with . i would call the method "strip_hidden_entries()" and just remove everything starting with a . (now how do you end a sentence if the last character is a dot which is not meant to be the period?)

dbemerlin
A: 

stripDotMetaDirs() or stripThoseDots() according to John Saunders's answer

Hannes de Jager
A: 
now STOP DOTS! STOP DOTS!
Erik Forbes
lol. I like unDot
Hannes de Jager
+1  A: 

Flip the problem:

Name the function getDirectories and just return everything except those. Then you don't need to mention them at all since it is fairly intuitive for them to not be included in a directory list.

JohnFx