Opened 17 years ago
Closed 17 years ago
#577 closed Bugs (Out of Date)
change_extension throw an invalid name exception
Reported by: | nobody | Owned by: | beman_dawes |
---|---|---|---|
Milestone: | Component: | filesystem | |
Version: | None | Severity: | |
Keywords: | Cc: |
Description
path change_extension(const path& ph, const std::string& new_extension) { return ph.branch_path() / basename(ph) + new_extension; } If we try with this code : string str = "toto titi.exe"; path p(str, native); path p2 = change_extension(p, ".txt"); Then in change_extension, basename will return a string, and / operator will throw an invalid name as "toto titi" is not a valid path. I made this correction : path change_extension(const path& ph, const std::string& new_extension) { return ph.branch_path() / path(basename(ph) + new_extension, native); } And it seems to be ok now.
Change History (2)
comment:2 by , 17 years ago
Status: | assigned → closed |
---|
Logged In: YES user_id=51042 In release 1.34 and later, native paths are identified automatically, so there is no longer any need for the native constructor. Thanks, --Beman
Note:
See TracTickets
for help on using tickets.