kevinius
kevinius

Reputation: 4618

Understanding relative paths

I'm having some trouble with understanding the meaning of this snippet. I know that __ DIR __ refers to my absolute path, in my case /Applications/MAMP/htdocs

__ DIR __.'/../app'

Where is this path looking for the folder /app?

thx,

Upvotes: 1

Views: 71

Answers (2)

rccoros
rccoros

Reputation: 590

This is looking for /app under /Applications/MAMP/

__ DIR __.'/../app'
____________^

That's because you have the .. which means parent directory.

Upvotes: 1

Realitätsverlust
Realitätsverlust

Reputation: 3953

This path means:

/Applications/MAMP/app

.. is the directory above. So he enters htdocs, enters the parentdirectory (which is MAMP) and then the directory app.

And for the knowledge: Should you ever see ., this means current directory. For example:

C:/Users/Admin/.

means exactly:

C:/Users/Admin/.

.. would mean:

C:/Users/

Upvotes: 2

Related Questions