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
19
votes
2 answers

Relative imports in python 2.5

I know that there are lots of questions about the same import issues in Python but it seems that nobody managed to provide a clear example of correct usage. Let's say that we have a package mypackage with two modules foo and bar. Inside foo we need…
sorin
  • 161,544
  • 178
  • 535
  • 806
19
votes
3 answers

How do you make _topdir relative to the location of the .spec file when building an RPM?

I have a .spec file that relies on a variable called _topdir. Right now when you checkout the SRPM source from git, you have to go and change where _topdir is pointing to to get the rpmbuild to function correctly. # We need the following line so…
user177800
19
votes
3 answers

how to reference a relative file from code and tests

I need to reference patients.json from patients.go, here's the folder structure: If I do: filepath.Abs("../../conf/patients.json") it works for go test ./... but fails for revel run If I do: filepath.Abs("conf/patients.json") the exact opposite…
Pablo Fernandez
  • 103,170
  • 56
  • 192
  • 232
19
votes
3 answers

iPhone dev: load a file from resource folder

I'm writing an iPhone app with a UIWebView which should display various html files I have in the app resource folder. In xcode my project overview, these html files are displayed like this: dirA |---> index.html |---> a1.html |---> a2.html |--->…
thomax
  • 9,213
  • 3
  • 49
  • 68
19
votes
4 answers

ASP.Net C# ResolveClientUrl inside Class

I have the following code: public class NavigationPath { private string menuItems = "
  • " + "home" + "
  • "; But I would like to have: public class…
    Marco
    • 1,272
    • 6
    • 22
    • 33
    19
    votes
    1 answer

    Relative file system write path within module

    I have a executable node / javascript script that has a debug boolean, if set to true a couple of files will be written. This executable is also node module. Depending on the working directory of the user running the script it seems that the…
    ThomasReggi
    • 55,053
    • 85
    • 237
    • 424
    19
    votes
    2 answers

    IIS virtual directory and ASP.NET directory paths

    The problem I'm running into the typical virtual-directory dilemma in that you have some paths on your ASP.Net application and you deploy the app in a IIS virtual directory. Then all paths relatives to the "web root" (f.i., "/images") doesn't work…
    David Elizondo
    • 1,123
    • 1
    • 7
    • 16
    19
    votes
    4 answers

    Java's File.toString or Path.toString with a specific path separator

    I am developing a Scala application on Windows, and I need to insert a path to a file into an HTML template. I use Java's io and nio to work with files and paths. /* The paths actually come from the environment. */ val includesPath =…
    Malte Schwerhoff
    • 12,684
    • 4
    • 41
    • 71
    19
    votes
    3 answers

    How to get absolute path of file or directory, that does *not* exist?

    How can I determine the absolute path of a file or directory from a given relative path in C/C++ on GNU/Linux? I know about realpath(), but it does not work on non-existing files. Let's say the user enters ../non-existant-directory/file.txt, and the…
    Fabian Henze
    • 980
    • 1
    • 10
    • 27
    18
    votes
    2 answers

    Multilevel relative import

    Multilevel relative import I have following folder structure top\ __init__.py util\ __init__.py utiltest.py foo\ __init__.py foo.py bar\ __init__.py foobar.py I want to access from foobar.py…
    Razer
    • 7,843
    • 16
    • 55
    • 103
    18
    votes
    6 answers

    HTML img and ASP.NET Image and relative paths

    What is the correct way to reference an image in ASP.NET for live deployment on IIS? The following works in dev and production:
    mmmbop
    • 181
    • 1
    • 1
    • 3
    18
    votes
    5 answers

    Should I use relative include paths for my project, or place the include-directory on the include path?

    In my project, I currently use relative paths to include my files, which admittedly doesn't change often. However, it yields pretty weird include patterns, because I usually nest my files in alot of folders. For example, in my current project I have…
    Max
    • 4,345
    • 8
    • 38
    • 64
    18
    votes
    5 answers

    R: source() and path to source files

    There must be something that I don't understand about the source() command in R. I'm still new to it, but I cannot for the life of me understand how it gets its directories from! My problem is this: I have a wrapper script, wrapper.R, and a source…
    erikfas
    • 4,357
    • 7
    • 28
    • 36
    18
    votes
    2 answers

    How to save generated file temporarily in servlet based web application

    I am trying to generate a XML file and save it in /WEB-INF/pages/. Below is my code which uses a relative path: File folder = new File("src/main/webapp/WEB-INF/pages/"); StreamResult result = new StreamResult(new File(folder, fileName)); It's…
    sjohnson
    • 315
    • 1
    • 3
    • 7
    18
    votes
    3 answers

    Python imports relative path

    I've got a project where I would like to use some python classes located in other directories. Example structure: /dir +../subdirA +../subdirB +../mydir The absolute path varies, because this project is run on different machines. When my python…
    daniel451
    • 10,626
    • 19
    • 67
    • 125