php - How to get realpath for virtual paths? -
if path ../b
, current directory /var/www/a/c
, realpath /var/www/a/b
but if b
doesn't exist, realpath() returns false.
is possible same path if directory doesn't exist yet?
it's not available pre-defined function format realpath()
, because it's impossible in reliable way.
as example, on macos, doing ls /etc/..
, you'd think you'd directory listing of /
. thing though /etc
soft link /private/etc
, doing ls /etc/..
gives listing of /private
.
this not calculated in advance if link did not yet exist, why there no function can solve in general sense without files/directories existing.
in other words, you'd have write own function solve specific problem.
Comments
Post a Comment