Fix getFileInfo name return value for paths that end with a slash.

This commit is contained in:
Sönke Ludwig 2017-06-12 17:31:52 +02:00
parent b5952208bc
commit 6f7c897f91

View file

@ -672,9 +672,9 @@ struct DirectoryChange {
private FileInfo makeFileInfo(DirEntry ent) private FileInfo makeFileInfo(DirEntry ent)
@trusted { @trusted {
FileInfo ret; FileInfo ret;
ret.name = baseName(ent.name); auto fullname = ent.name.endsWith('/') || ent.name.endsWith('\\') ? ent.name[0 .. $-1] : ent.name;
if( ret.name.length == 0 ) ret.name = ent.name; ret.name = baseName(fullname);
assert(ret.name.length > 0); if (ret.name.length == 0) ret.name = fullname;
ret.size = ent.size; ret.size = ent.size;
ret.timeModified = ent.timeLastModified; ret.timeModified = ent.timeLastModified;
version(Windows) ret.timeCreated = ent.timeCreated; version(Windows) ret.timeCreated = ent.timeCreated;