[TYPO3-50-general] Common namings for variables with path-content
Robert Lemke
robert at typo3.org
Mon Jan 12 10:02:29 CET 2009
Hi Malte,
Am 11.01.2009 um 19:41 schrieb Malte Jansen:
> If you have a variable-name, sometimes it is unclear what the variable
> realy contains, because of double meanings.
>
> There several names for a "path" aka "folder" aka "directory"
>
> directory:
> An absolute path, which must exists. (PHP: is_dir() === TRUE)
> e.g. is_dir($someDirectory)
>
> path:
> Might be a relative path or a path which might not yet exist.
> You have to "manipulate" the variable-content to achieve a
> directory/absolute path (PHP: is_dir() === TRUE).
> e.g.
> is_dir($someDirectory . $somePath)
> is_dir(realpath($someRelativePath))
>
> folder:
> Normally just used in the windows95-world. Shouldn't be used.
>
> It would be nice if you always know what kind of path it is, without
> looking at the API or the code.
I suggest the following wording:
- "path"
Usually an absolute path in special cases relative. A path leads to
directories and files and is used as a prefix. It always ends with
a trailing slash.
Example:
"/usr/local/foo/bar/" is the path leading to the file "/usr/
local/foo/bar/baz.txt"
To clearify the value, also "absolutePath" or "relativePath" can
be used.
- "directoryName"
Name of a directory, without slashes.
Example:
"foo", "bar"
- "fileName"
Name of a file, including extension
Example:
"myCrazy_weird.file.txt"
If a directory exists or not doesn't play a role IMO.
Cheers,
robert
More information about the TYPO3-project-5_0-general
mailing list