0

While looking over documentation of projects, tools etc. I have noticed individuals prepending a period to a file path:

pic from gulp-sprite documentation

I have tried with and without and it still works, but why do people use the convention?

Antonio Pavicevac-Ortiz
  • 7,239
  • 17
  • 68
  • 141
  • 1
    possible duplicate of [What does "./" (dot slash) refer to in terms of an HTML file path location?](http://stackoverflow.com/questions/7591240/what-does-dot-slash-refer-to-in-terms-of-an-html-file-path-location) – Turnip Apr 08 '15 at 19:28

1 Answers1

1

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 ..

deceze
  • 510,633
  • 85
  • 743
  • 889