Vlad
Vlad

Reputation: 8268

What is "/path/to"?

I've been doing web programming for some time now, and don't consider myself so much of a total newbie but I still don't understand what "/path/to" is. People use that code a lot, and I used to think it's just a way to refer to main path. But I started wondering why so many people use that syntax so uniformly, because it's confusing if it's meant to be NOT taken literally. Most people would actually type in "/path/to".

So I tried searching for "/path/to" on google, but this is something that's hard to search on a generic search engine, so no luck. So I decided to ask here. Is "/path/to" some kind of jargon that people use to refer to something? If yes, what does it exactly refer to? If no, then how does it work internally?

Upvotes: 4

Views: 5294

Answers (2)

Sergio Tulentsev
Sergio Tulentsev

Reputation: 230296

This is just a placeholder for an actual path in your environment. I usually use it when I want to abstract from the path I use on my machine. It does not matter and the reader/user of my code will likely have it different. So I prefer to clearly indicate what places they should amend.

Other examples of this sort:

GET http://example.com
ssh username@host

Upvotes: 6

Code-Apprentice
Code-Apprentice

Reputation: 83527

/path/to/project and similar constructs are used in documentation and blog posts to abstract away details that vary on different machines and for different people. For example, I might be working on a project on my Linux machine that is at /home/code-apprentice/src/my-cool-ruby-project. At the same time, you are working on a project on your Windows machine that you put at C:\Users\Vlad\Projects\MyEvenBetterRubyProject. We both are reading the same blog article to implement a feature. The detail of the exact path where we each store our project doesn't matter for the particular part of Ruby on Rails that we are using. The notation /path/to/project is just a convenient and concise placeholder to describe the root of the project that varies between our machines.

Upvotes: 2

Related Questions