Overview
Features
Download
Documentation
Community
Add-Ons & Services

Path class -- how to get just the directory portion?

Please post support and help requests here.

Path class -- how to get just the directory portion?

Postby jimfr » 05 Mar 2009, 02:03

There is getBaseName and getExtension, but how to get just the directory without the filename? Seems like it needs a getDirectory().
jimfr
 
Posts: 8
Joined: 05 Mar 2009, 01:58

Re: Path class -- how to get just the directory portion?

Postby guenter » 05 Mar 2009, 07:29

Poco::Path path("/home/user/foo.txt");
Poco::Path parent(path.parent());
std::string s(parent.toString()); // "/home/user/"
guenter
 
Posts: 1092
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: Path class -- how to get just the directory portion?

Postby jimfr » 05 Mar 2009, 20:39

Thank you! I had been assuming parent just returned one dir component, i.e. "/user"
jimfr
 
Posts: 8
Joined: 05 Mar 2009, 01:58


Return to Support

Who is online

Users browsing this forum: No registered users and 3 guests

cron