[Boost-bugs] [ boost-Bugs-1444697 ] change_extension throw an invalid name exception

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Boost-bugs] [ boost-Bugs-1444697 ] change_extension throw an invalid name exception

SourceForge.net
Bugs item #1444697, was opened at 2006-03-07 01:19
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1444697&group_id=7586

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: filesystem
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Beman Dawes (beman_dawes)
Summary: change_extension throw an invalid name exception

Initial Comment:
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.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1444697&group_id=7586


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Boost-bugs mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/boost-bugs
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost