Proposal for std.path replacement

"Jérôme M. Berger" jeberger at free.fr
Sun Mar 6 03:50:29 PST 2011


Rainer Schuetze wrote:
> Looks good overall. I have a few comments and nitpicks though:
> 
>>   basename("dir/subdir/")             -->  "subdir"
>>   directory("dir/subdir/")      -->  "dir"
> 
	I would say:
basename ("dir/subdir/") -> "" (or ".")
dirname  ("dir/subdir/") -> "dir/subdir"
basename ("dir/subdir")  -> "subdir"
dirname  ("dir/subdir")  -> "dir"

	Same as Python does.

> Is this what everybody expects? I'm not sure, but another possibility
> would be to treat these as if "dir/subdir/." is passed. What is the
> result of directory("/") or directory("d:/")?
> 
>>   extension("file")               -->  ""
>>   extension("file.ext")           -->  "ext"
> 
extension ("file")     -> ""
extension ("file.ext") -> ".ext"
extension ("file.")    -> "."

> What about "file."? I tried it on NTFS, but trailing '.' seems to always
> be cut off. Is it possible to create such a file on unix systems? If
> yes, you won't be able to recreate it from the result of basename() and
> extension().
> 
		Jerome
-- 
mailto:jeberger at free.fr
http://jeberger.free.fr
Jabber: jeberger at jabber.fr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20110306/f2d7f520/attachment.pgp>


More information about the Digitalmars-d mailing list