Closed danielbachhuber closed 7 years ago
@schlessera I'm not sure realpath()
is the way to go because:
The running script must have executable permissions on all directories in the hierarchy, otherwise
realpath()
will return FALSE.
Thoughts?
Maybe use our own helper functions, something like this: https://3v4l.org/9Ga8c
Drush uses this: https://github.com/webmozart/path-util
As it's very Unixy could just do something like
if ( '~/' === substr( $package_dir, 0, 2 ) && ( $home = getenv( 'HOME' ) ) ) {
$package_dir = $home . substr( $package_dir, 1 );
}
@gitlost Yes, I suggested a more robust version of that here: https://3v4l.org/9Ga8c
@schlessera @gitlost Updated. I went with the simpler approach to begin with.
I'm not sure why you'd want to solve this partially only. It is highly probable someone will want to use a relative path with this as well, and just create a new bug report at that point.
Additionally, having ~
work, and not .
or ..
makes it even worse in that it is inconsistent as well.
I don't see how a relative path or .
or ..
won't just work - just tried --dir=~/../blah
and it worked...
Oh, okay, I just assumed it would create issues as well. All good then.
Fixes #119