Questions tagged [absolute-path]

global address for a file, independent from the working directory of the calling process

An absolute (or full) path is the general form of the name of a file or directory that specifies a unique location in a file system. An absolute path contains the root directory and all other subfolders in which the requested file or folder is contained.

833 questions
13
votes
7 answers

Checking for relative vs absolute paths/URLs in PHP

I need to implement functions to check whether paths and urls are relative, absolute, or invalid (invalid syntactically- not whether resource exists). What are the range of cases I should be looking for? function check_path($dirOrFile) { // If…
Yarin
  • 173,523
  • 149
  • 402
  • 512
13
votes
1 answer

Is the a.href property always returned as absolute?

In the following HTML: Page I'm finding that document.getElementById("link").href always returns the absolute path to page.htm rather than the relative path as I have typed it. See http://jsfiddle.net/4HgAW/. Can I…
Flash
  • 15,945
  • 13
  • 70
  • 98
13
votes
2 answers

When to use Absolute Path vs Relative Path in Python

For reference. The absolute path is the full path to some place on your computer. The relative path is the path to some file with respect to your current working directory (PWD). For example: Absolute path: C:/users/admin/docs/stuff.txt If my PWD…
samGon
  • 131
  • 1
  • 1
  • 3
11
votes
2 answers

How to determine absolute path (if any) of a loaded Class?

Is there a (compatible, if possible) way to determine the absolute path of a loaded Class? Of course, this is not always possible (if you think of dynamically created classes), but if the loaded Class is inside a jar how to get the absolute path for…
MRalwasser
  • 15,605
  • 15
  • 101
  • 147
11
votes
4 answers

Absolute URL from base folder with rewrite

I have a project running local on WampServer. It's an MVC-like structure; it rewrites the URL to index.php?url=$1. Full .htaccess: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond…
11
votes
1 answer

How to open a file with relative path in C++?

I am writing test cases right now and I created some test files which I try to read. The absolute path is: /home/user/code/Project/source/Project/components/Project/test/file.dat but testing with an absolute path is bad for obvious reasons. So I…
Peter111
  • 803
  • 3
  • 11
  • 21
11
votes
5 answers

How to determine the directory in which a running Haskell script or application lives?

I have a Haskell script that runs via a shebang line making use of the runhaskell utility. E.g... #! /usr/bin/env runhaskell module Main where main = do { ... } Now, I'd like to be able to determine the directory in which that script resides from…
Chris W.
  • 1,680
  • 16
  • 35
11
votes
3 answers

Find command to return absolute path

I'm using find command a lot on unix (csh). Is it possible that the result will be full/absolute path and will start from the directory where I'm starting the search for example when running command from /project/Test/v0.15/test/frontend, the …
Jonathan
  • 285
  • 3
  • 9
11
votes
2 answers

Are protocol-relative URLs relative URLs?

So consider a protocol-relative URL like so; //www.example.com/file.jpg The idea I've had in my head for as long as I can remember is that protocol-relative URLs are in fact absolute URLs. They behave exactly like absolute URLs, and never do they…
Emphram Stavanger
  • 4,158
  • 9
  • 35
  • 63
11
votes
2 answers

gcc/gdb: How to embed absolute path to source file in debug information?

i am just wondering if i can tell gcc to embed the absolute path to a source file in the debug information, even if i call gcc like gcc -g ../src/somecode.c -o ../bin/somecode.o as i see it atm, gcc just stores what you provide, so if you provide…
rti
  • 113
  • 1
  • 6
10
votes
2 answers

Get running file name in Java?

Is it possible to get the file name which is being executed. Like e.g. If i am running a Jar file, and inside i want to add code functionality that can detect the file name so that if this jar is renamed, code should be able to detect that. Is…
Johnydep
  • 6,027
  • 20
  • 57
  • 74
10
votes
7 answers

get absolute path to apache webcontents folder from a java class file

Need to get absolute path in java class file, inside a dynamic web application... Actually i need to get path of apache webapps folder... where the webapps are deployed e.g.…
Ahsan Mumtaz
  • 115
  • 1
  • 1
  • 6
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
4 answers

Absolute path without symlink resolution / Keep user in home directory

Is there a way in PHP how to determine an absolute path given a relative path without actually resolving symlinks? Something like the realpath function but without symlink resolution. Or alternatively, is there some easy way to check whether user…
NumberFour
  • 3,551
  • 8
  • 48
  • 72
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