Skip to main content

expand_filepath

Function expand_filepath 

Source
pub fn expand_filepath(path: &[u8]) -> Option<Vec<u8>>
Expand description

expand_filepath(): the absolute path PHP opens for path. A relative path is resolved against the working directory, then . and .. components and repeated slashes are removed lexically (a trailing slash stays), without resolving symbolic links. None for an empty path or one longer than MAXPATHLEN.

use php_std::path::expand_filepath;

assert_eq!(expand_filepath(b"/tmp/a/../b//c/."), Some(b"/tmp/b/c".to_vec()));
assert_eq!(expand_filepath(b"/.."), Some(b"/".to_vec()));