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
11
votes
3 answers

Relative Paths in Winforms

Relative paths in C# are acting screwy for me. In one case Im handling a set of Texture2d objects to my app, its taking the filename and using this to locate the files and load the textures into Image objects. I then load an image from a relative…
Michael Allen
10
votes
3 answers

building relative URLs for an MVC app with JavaScript

I'm having trouble getting C# and JavaScript/jQuery to play nice here. I have a knockout view model, plain old javascript object... one of its property/methods fires off an .ajax() call, and the url parameter is built using some of its other…
one.beat.consumer
  • 9,414
  • 11
  • 55
  • 98
10
votes
3 answers

XCode, folders and #import statement

I'm writing an app for the iOS in XCode 4 and stumbled upon an issue with #import statement. All my source files are organized in folders, every folder is mapped to the group or subgroup in XCode. Consider the…
Dmitriy
  • 1,852
  • 4
  • 15
  • 33
10
votes
3 answers

How to change the location of a grouped (localization) file from an absolute to a relative path in XCode 4?

I'm having problems with making all file location paths relative in XCode 4. I have multiple infoPlist.strings and CustomLocalizable.strings (for different languages) grouped together (XCode does this automatically). When looking at the File…
Visionscaper
  • 3,979
  • 1
  • 23
  • 26
10
votes
0 answers

Static Assets URL as absolute path or relative path in API Response

I have a Spring boot API service , other websites and mobile apps call this API for data and images. Images are stored in file system and file path in database. I am looking for best practice to return image URLs in API response. Sample DB…
Mukun
  • 1,756
  • 10
  • 30
  • 57
10
votes
4 answers

How can I use relative importing in Python3 with an if __name__='__main__' block?

I am making a package, and the modules within this package have code inside if __name__=='__main__': blocks for testing purposes. But my attempts to use relative imports in these modules causes errors. I have read this thread and the billion…
pyjamas
  • 4,608
  • 5
  • 38
  • 70
10
votes
1 answer

GitHub relative internal repository links in PULL_REQUEST_TEMPLATE.md

Using a relative link as directed (https://help.github.com/articles/about-readmes/#relative-links-and-image-paths-in-readme-files) in a PULL_REQUEST_TEMPLATE.md does not relatively link correctly. When viewed in an actual…
Clif
  • 101
  • 7
10
votes
3 answers

Robot Framework - using relative paths to run tests from different directory variations

I am running into an issue with my Robot Framework test suites. I have a simple test structure like this: robotframework |_foo |_tests folder |_pages folder |_firefoxTestProfile folder |_... I have set a bare bones Firefox Profile path to run…
chmc
  • 265
  • 1
  • 5
  • 12
10
votes
2 answers

How do you resolve a relative Uri?

Given an absolute Uri and a relative Uri or relative path, how do you get the absolute Uri pointing to the relative location? For example, suppose we have the Uri for file:///android_asset/dir, pointing to a location in our assets. Further suppose…
CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
10
votes
6 answers

How to get a path from a directory in a C# console application?

Say I have this file structure Soultion-> Folder1 -> FileIwant.html So this could be something like C:\Soultion\Folder1\FilterIwant.html Now I need to read this file into my application. I can't just hardcode it since when I give it to someone else…
chobo2
  • 83,322
  • 195
  • 530
  • 832
10
votes
5 answers

Reference a Text File with relative path in Java with the IntelliJ IDEA

I have a program that reads numbers from a .txt file. My problem is where to place this file, or how to reference it with a relative path to make this file accessible without using the absolute path.
gangwerz
  • 435
  • 2
  • 8
  • 18
10
votes
2 answers

Python - from . import

I'm taking my first stab at a library, and I've noticed the easiest way to solve the issue of intra-library imports is by using constructions like the following: from . import x from ..some_module import y Something about this strikes me as 'bad.' …
Clay Wardell
  • 14,846
  • 13
  • 44
  • 65
10
votes
1 answer

What's the point of using absolute urls in Pelican?

About RELATIVE_URLS, the Pelican docs say: …there are currently two supported methods for URL formation: relative and absolute. Relative URLs are useful when testing locally, and absolute URLs are reliable and most useful when publishing.…
mlissner
  • 17,359
  • 18
  • 106
  • 169
10
votes
4 answers

Path of current PHP script relative to document root

TL;DR: What alternatives to the last code sample on this page are there when trying to use relative links on pages included with PHP's include command? I'm trying to include() a file that links to a .css document, the problem is that I need to…
10
votes
3 answers

Absolute path & Relative Path

What's the difference between absolute path & relative path when using any web server or Tomcat?
Phani Kumar Bhamidipati
  • 13,183
  • 6
  • 24
  • 27