Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between path and URL in iOS?

In a class such as NSFileManager there are 2 versions of practically every method. One for paths and one for URLs. What's the difference? And what's the best practice for converting a URL to a path.

like image 448
Andrew Avatar asked Jul 01 '11 09:07

Andrew


People also ask

What is path and URL?

A URL (Uniform Resource Locator) identifies a resource on a remote server and gives the network location on that server. The URL path is the string of information that comes after the top level domain name. You can use the HTTP-proxy to block websites that contain specified text in the URL path.

Can a file path be a URL?

1 Answer. Show activity on this post. file is a registered URI scheme (for "Host-specific file names"). So yes, file URIs are URLs.

What is a path in a link?

The path refers to the exact location of a page, post, file, or other asset. It is often analogous to the underlying file structure of the website. The path resides after the hostname and is separated by “/” (forward slash).

What is the difference between URL and path in Django?

The path function is contained with the django. urls module within the Django project code base. path is used for routing URLs to the appropriate view functions within a Django application using the URL dispatcher.


2 Answers

path is location of a resource (file/directory) in a file system. Just like iOS File System, other environments file system can be Windows file system, Unix etc. Path can have spaces like /docs/random doc/. (between random and doc)

URL is is a reference to a resource anywhere (file system, web HTTP, FTP etc). URL can not have spaces like path.

Web URL: http://stackoverflow.com/
file URL: file://localhost/Users/username/docs/random%20docs/
path for above mentioned file URL: /Users/username/docs/random%20docs/

in layman terms:

URL = protocol (http, file etc) + host (domain name or IP or localhost) + path

like image 96
Saurabh Hooda Avatar answered Sep 28 '22 04:09

Saurabh Hooda


URL includes the protocol being used (http:// etc). Path doesn't or doesn't need at least.

like image 38
bluehallu Avatar answered Sep 28 '22 03:09

bluehallu