Table of contents
Namespace: Com\Tecnick\File
File: Dir.php line 34
Writable parent-directory lookup
Tags
- since: 2015-07-28
- category: Library
- author: Nicola Asuni info@tecnick.com
- copyright: 2015-2026 Nicola Asuni - Tecnick.com LTD
- license: https://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE)
- link: https://github.com/tecnickcom/tc-lib-file
Methods
findParentDir()
File: Dir.php line 53
public findParentDir(string $name[, string $dir = __DIR__ ]) : string
Walks up from $dir looking for a writable directory named $name. A read-only directory of that name, or a regular file bearing it, is skipped.
Parameters
- $name : string: Single directory name to search for. An empty or absolute name, or one containing a path separator or a parent-directory segment, is reported as not found.
- $dir : string = __DIR__: Starting directory. A relative one is anchored to the current working directory first.
Return values
string —
Directory name with a trailing separator, or an empty string when no writable match exists up to the filesystem root.