← Back to index
|
Original Bugzilla link
Bug 10601 – std.path.setExtension leaves trailing dot if extension is empty
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-07-10T16:42:00Z
Last change time
2013-07-29T08:32:53Z
Keywords
pull
Assigned to
nobody
Creator
hsteoh
Comments
Comment #0
by hsteoh — 2013-07-10T16:42:01Z
Code: -----snip----- import std.path, std.stdio; void main() { version(Windows) string ext = ".exe"; version(Posix) string ext = ""; string srcfile = "program.d"; writeln(setExtension(srcfile, ext)); } -----snip----- Output on Posix is "program." (with the stray trailing dot). When an empty extension is given, setExtension should simply strip the extension.
Comment #1
by hsteoh — 2013-07-25T15:25:13Z
https://github.com/D-Programming-Language/phobos/pull/1409
Comment #2
by github-bugzilla — 2013-07-29T08:30:58Z
Commits pushed to master at
https://github.com/D-Programming-Language/phobos
https://github.com/D-Programming-Language/phobos/commit/e43433f56682e8964596fbff5a9ea8b1fc32f927
Fix issue 10601. If extension is empty, std.path.setExtension should be equivalent to std.path.stripExtension. This special case is useful in generic code that needs to alternate between, e.g., .exe on Windows and no executable extension on Posix.
https://github.com/D-Programming-Language/phobos/commit/f2bd29cb97033ae041ebfd32690f01ddb25b98b7
Merge pull request #1409 from quickfur/issue10601 Fix issue 10601.