Questions tagged [relative-path]

Relative-paths are URI or directory links to resources that refer to a location relative to the current path.

A relative path references a resource in relation to a current path or directory; its opposite is an absolute path. Web pages frequently make use of relative paths to refer to resources like images and scripts. The advantage of using a relative path is that it remains valid when the host name or root path changes.

As an example, consider a website located at the URL:

http://www.hostname.com/site/page.html

If the page wants to reference an image located at:

http://www.hostname.com/site/images/image.jpg

It could simply make reference to the relative path images/image.jpg.

2470 questions
28
votes
3 answers

HTML force URL hyperlink to be treated as non-relative (absolute)

I have a list of URLs that our users have entered for websites of various clients... I am loading this list from the server into a grid for the users to see... I made the URLs clickable by wrapping them with a href HTML tag... the problem is,…
Ayyoudy
  • 3,641
  • 11
  • 47
  • 65
28
votes
7 answers

Ruby path management

What is the best way to manage the require paths in a ruby program? Let me give a basic example, consider a structure like: \MyProgram \MyProgram\src\myclass.rb \MyProgram\test\mytest.rb If in my test i use require '../src/myclass' then I can…
Miguel Fonseca
28
votes
3 answers

Is there a way to setup Linked Resources relative to the .project file?

We have a Flash Builder (which is based on Eclipse) project that pulls source from different locations, included in the source control in which the project is. As per our organization requirements, the source code is present in directories not…
JohnWithoutArms
  • 541
  • 2
  • 6
  • 5
28
votes
4 answers

Is it possible to make a shortcut to a relative path in Windows that runs as admin?

To create a shortcut with a relative path, set the target to the following. %windir%\system32\cmd.exe /c start your_relpath\app.exe [your_args] It is also straightforward to make the program run as administrator. Properties > Advanced > Run as…
Trevor Merrifield
  • 4,541
  • 2
  • 21
  • 24
28
votes
7 answers

PHP: How to resolve a relative url

I need a function that given a relative URL and a base returns an absolute URL. I've searched and found many functions that do it different ways. resolve("../abc.png", "http://example.com/path/thing?foo=bar") # returns http://example.com/abc.png Is…
Paul Tarjan
  • 48,968
  • 59
  • 172
  • 213
27
votes
3 answers

Why relative path doesn't work in Ruby require

I'm starting learning Ruby, one thing that I don't understand, why relative path for require directive doesn't work in ruby. It's something that works almost in every scripting language that I now (JSP, PHP...). I explain with a real example. I have…
Amaynut
  • 4,091
  • 6
  • 39
  • 44
27
votes
3 answers

Converting an absolute path to a relative path

Working in Node I need to convert my request path into a relative path so I can drop it into some templates that have a different folder structure. For example, if I start with the path "/foo/bar" and want the relative path to "/foo", it would be…
robdodson
  • 6,616
  • 5
  • 28
  • 35
26
votes
4 answers

Removing %20 from URI Relative Path

I am generating a relative path from 1 directory to another. If the OutputDirectoryName property is a directory containing spaces, the spaces are encoded using %20, rather than a space. I am creating a relative path to a windows folder, so I must…
Stealth Rabbi
  • 10,156
  • 22
  • 100
  • 176
26
votes
5 answers

Linking using relative path on Github README.md

I am trying to create links in my README.md that link to example code using a relative path, as opposed to the absolute path I am using now. For example, in the markdown file, if I use…
Houdini
  • 3,442
  • 9
  • 31
  • 47
25
votes
4 answers

Relative Path, but for Port?

We are all familiar with relative paths: A relative path to ./images/hello.jpg from http://www.domain.com/hey links to http://www.domain.com/hey/images/hello.jpg. Problem: How do you state a relative path to http://www.domain.com:1234 when you are…
Nyxynyx
  • 61,411
  • 155
  • 482
  • 830
25
votes
4 answers

Java - Loading dlls by a relative path and hide them inside a jar

PART 1 I am developing a Java application that should be release as a jar. This program depends on C++ external libraries called by JNI. To load them, I use the method System.load with an absolute path and this works fine. However, I really want to…
supertreta
  • 359
  • 1
  • 6
  • 10
25
votes
5 answers

How to strip the basedir from an absolute path to get a relative path?

In the build.xml of my project I have a property defined: The value of ${somedir.dir} will be an absolute path: /home/myuser/my_project/some_dir. What I need is just the relative path…
blackicecube
  • 1,393
  • 5
  • 15
  • 15
25
votes
2 answers

How can I use relative path to read local files in Django app?

My django app has to read some text files from the file system. So I make a directory in my app directery, and use relative path to open and read from the file. areas = parseXmlFile('xml_files/area.xml') When I run server to debug using manage.py…
bitcold
  • 653
  • 2
  • 8
  • 10
25
votes
2 answers

How to concatenate an absolute path and relative path with QDir?

I have a relative path and absolute path that look something like this: Absolute: /tmp/somedir Relative: anotherdir/file.txt I would like to concatenate the two (/tmp/somedir/anotherdir/file.txt) with QDir but I am not quite sure what the proper…
Nathan Osman
  • 71,149
  • 71
  • 256
  • 361
24
votes
4 answers

How do I call another PowerShell script with a relative path?

I have the following directory tree: e:\powershell\services\This-Script-Here-Should-Call-Press any key to continue.ps1 e:\powershell\utils\Press any key to continue.ps1 and now I'd like to call a script named "Press any key to continue.ps1" that…
t3chb0t
  • 16,340
  • 13
  • 78
  • 118