## c++.stlsoft - [filesystem::basic_path] How Do I Extract the Folder Name?

• Adi (6/6) Jul 14 2009 Hi,
• Matthew Wilson (6/11) Jul 14 2009 But isn't that appropriate? The folder containing c:\abc\def is c:\abc?
• Adi (7/28) Jul 15 2009 Thanks for the prompt reply.
• Matt Wilson (2/8) Jul 15 2009 Makes sense. I'll check it out
• Adi (3/4) Jul 20 2009 Thanks!
• Matthew Wilson (4/8) Aug 11 2009 This is now available in the latest beta (alpha 12) of STLSoft 1.10, in ...
Adi <adishavit__without_this_part__+web-news gmail.com> writes:
Hi,

Is there a way to get the folder name of a given path?
Obviously, if I know that the path is a file name I can just pop(), but if it
is a folder name then pop() gives me the folder above it.

I think a get_folder() (and is_folder()) is a missing complement to get_ext()
and get_file().

Thanks,
Adi

Jul 14 2009
"Matthew Wilson" <matthew hat.stlsoft.dot.org> writes:
"Adi" <adishavit__without_this_part__+web-news gmail.com> wrote in message
news:h3i5e7$2rjr$1 digitalmars.com...
Hi,

Is there a way to get the folder name of a given path?
Obviously, if I know that the path is a file name I can just pop(),

yes

but if it is a folder name then pop() gives me the folder above it.

But isn't that appropriate? The folder containing c:\abc\def is c:\abc?

Or am I misunderstanding you?

I think a get_folder() (and is_folder()) is a missing complement to get_ext()
and get_file().

If it makes sense, I'll happily add it. Just a trifle confused by what you
require. (It's early, and I've just done a hard workout,
so brain probably not functioning at top speed ;-)

Jul 14 2009
Adi <adishavit__without_this_part__+web-news gmail.com> writes:
Thanks for the prompt reply.
Let me rephrase my Q:

pop_sep()  and pop_ext() do nothing if there is no separator or file extension
resp. -- they are idempotent.

In the same manner, I'd like a "pop_filename()" that will leave only the
folder/directory name. If there was a filename it will be removed, if there
wasn't the result will stay the same. This function will also be idempotent.

Thanks,
Adi

Matthew Wilson Wrote:

"Adi" <adishavit__without_this_part__+web-news gmail.com> wrote in message
news:h3i5e7$2rjr$1 digitalmars.com...
Hi,

Is there a way to get the folder name of a given path?
Obviously, if I know that the path is a file name I can just pop(),

yes

but if it is a folder name then pop() gives me the folder above it.

But isn't that appropriate? The folder containing c:\abc\def is c:\abc?

Or am I misunderstanding you?

I think a get_folder() (and is_folder()) is a missing complement to get_ext()
and get_file().

If it makes sense, I'll happily add it. Just a trifle confused by what you
require. (It's early, and I've just done a hard workout,
so brain probably not functioning at top speed ;-)


Jul 15 2009
Matt Wilson <matthewwilson acm.org> writes:
Adi Wrote:

Thanks for the prompt reply.
Let me rephrase my Q:

pop_sep()  and pop_ext() do nothing if there is no separator or file extension
resp. -- they are idempotent.

In the same manner, I'd like a "pop_filename()" that will leave only the
folder/directory name. If there was a filename it will be removed, if there
wasn't the result will stay the same. This function will also be idempotent.

Makes sense. I'll check it out

Jul 15 2009
Adi <adishavit__without_this_part__+web-news gmail.com> writes:
Thanks!

Matt Wilson Wrote:

<... snip>

Makes sense. I'll check it out


Jul 20 2009
"Matthew Wilson" <matthew hat.stlsoft.dot.org> writes:
This is now available in the latest beta (alpha 12) of STLSoft 1.10, in the
platformstl::basic_path class

Let me know how you go

Matt

"Adi" <adishavit__without_this_part__+web-news gmail.com> wrote in message
news:h41lc6$21ka$1 digitalmars.com...
Thanks!

Matt Wilson Wrote:

<... snip>

Makes sense. I'll check it out


Aug 11 2009