While looking over documentation of projects, tools etc. I have noticed individuals prepending a period to a file path:
I have tried with and without and it still works, but why do people use the convention?
While looking over documentation of projects, tools etc. I have noticed individuals prepending a period to a file path:
I have tried with and without and it still works, but why do people use the convention?
It depends on the specific environment whether a .
has a specific meaning. In general .
stands for the current directory (and ..
being the parent directory). If the environment uses a PATH
-like lookup system, there may well be a difference between ./foo
and foo
.
The PATH
is an environment variable in many systems which defines several paths in which files are looked up. E.g. PATH=/bar:/baz:.
. This mean, when you try to refer to file foo
, this will be looked up as /bar/foo
, /baz/foo
and ./foo
, the first one to match wins.
As such, the difference can be important if the system uses such a relative lookup. I'm not clear on whether gulp does specifically. If it doesn't, it's relatively redundant to use .
.