Questions tagged [realpath]

The canonical path of the specified filename.

The canonical path of the specified filename, eliminating any symbolic links encountered in the path (if they are supported by the operating system)

127 questions
1
vote
1 answer

Determine if path is inside directory

In my application, I am trying to check if a path is inside of a specific directory. E.g., I want the files in the path /x/y/z not to be accessible by parts of my application. I cannot use traditional file permissions, as other parts of the…
user2737037
  • 1,119
  • 1
  • 16
  • 29
1
vote
1 answer

How can I filter nonexistent files when piping through xargs realpath?

I have gotten into the habit of using the following command to quickly open relevant files in my editor for code reviews. git diff --name-only master... | xargs realpath | someEditor But recently been encountering a problem where the first or…
Brad
  • 741
  • 7
  • 17
1
vote
0 answers

How to reliably resolve a path relative to another?

In PHP, is there a built-in way to resolve a path relative to another? For example, given a $baseDir dir: /home/ben/project, the following $path should resolve to: /foo/bar → /foo/bar ../foo/bar, → /home/ben/foo/bar Solutions that come to…
BenMorel
  • 34,448
  • 50
  • 182
  • 322
1
vote
0 answers

cross-plat version of _wfullpath()

is there a cross platform version of _fullpath() which is windows specific function? looking for a portable library function for this. tried realpath() but this is supported for linux and Mac but not for windows.
Nivedita
  • 23
  • 4
1
vote
2 answers

PHP realpath('./models') returns "" or null?

When I try realpath('./') I get "D:\Projects\Tickle\public" But when I try realpath('./models'); // or './models/' I get "" or null. why is that? The strange thing is that when I try realpath('../application/models'); I get…
Jiew Meng
  • 84,767
  • 185
  • 495
  • 805
1
vote
1 answer

Get original path capitalization on case-insensitive file system

A small problem with getting the real directory name for a file. I ran into this while investigating php-code-coverage's code. On my system running Mac Os I have a structure like this: /project/src/Directory/FileName.php But if I call realpath()…
Gino Pane
  • 4,740
  • 5
  • 31
  • 46
1
vote
1 answer

realpath on Cygwin is not same as PWD

$ pwd /home/Thomas/Utveckling/Cgreen/thoni56/cgreen $ realpath . /cygdrive/c/Users/Thomas/Utveckling/Cgreen/thoni56/cgreen $ cygpath -a . /cygdrive/c/Users/Thomas/Utveckling/Cgreen/thoni56/cgreen/ Why is this? Why is absolute path from the root…
thoni56
  • 3,145
  • 3
  • 31
  • 49
1
vote
1 answer

Android: how to get real file path from image Uri from gallery?

After choosing an image from gallery i want to upload it with retrofit2. https://futurestud.io/blog/retrofit-2-how-to-upload-files-to-server to do this i have to get the real file path. allImgUris.get(0) gives…
dilux
  • 277
  • 1
  • 3
  • 10
1
vote
2 answers

Is there a way to include the ~ in the output of realpath

realpath is very nice in that it gives you a simple way to get the real path of a file, but I can't figure out a way to satisfy my needs (without doing my own string manipulation, and therefore potentially missing the corner cases that a dedicated…
iconoclast
  • 21,213
  • 15
  • 102
  • 138
1
vote
0 answers

make realpath() in c++ not to resolve symlink

I am using this code to get absolute path of a file: String getAbsolutePath(String x){ char path[FILENAME_MAX+1]; realpath(x.c_str(),path); return toString(path); } But the realpath() function resolves symlinks too. How can I not…
Jahid
  • 21,542
  • 10
  • 90
  • 108
1
vote
1 answer

My realpath return null for files

I begin in C and i need to use the function realpath but i havn't find many exemple. I helped myself of it : link. My current problem is that my function works for a folder but realpath return null when it's a file. while ((dir = readdir(rep)) !=…
filol
  • 341
  • 2
  • 10
1
vote
1 answer

php realpath not producing usable outcome

Unfortunately this produces the…
Andy Cheeseman
  • 283
  • 1
  • 3
  • 13
1
vote
1 answer

Path with params and php realpath

During the merger of several css need convert relative paths to absolute. One of the steps - get realpath. There Bootstrap with its css: @font-face { font-family: 'Glyphicons Halflings'; src: url('../fonts/glyphicons-halflings-regular.eot'); …
lifecom
  • 11
  • 2
1
vote
1 answer

Confustion with realpath() buffer

Here's my function, which is looking for regular files in given directory, and then storing full path to them in a list. static my_func(const char *path, Files **list) //list - storage for file names { DIR *d; struct dirent *dir; char…
1
vote
2 answers

Realpath not working with ../files?

I am developing under wamp. echo realpath(APPPATH); C:\wamp\www\salsaritmo\system\application echo realpath(APPPATH . '..'); C:\wamp\www\salsaritmo\system echo realpath(APPPATH . '../files'); //(which is the one i want) returns nothing
Babak
  • 279
  • 1
  • 7
  • 16
1 2 3
8 9