Boost logo

Boost Users :

From: Pete (petehug_at_[hidden])
Date: 2004-11-16 15:42:29


I create two additional boost::filesystem convenience functions:

1) boost::filesystem::is_match(): Compare a given
::boost::filesystem::path object with a file pattern. Throws a
boost::filesystem::filesystem_error object if ph does not exists or is
not a path to a file. The pattern supports the simple '*' and '?'
wildchars and does case insensitive compartes under WIN32.

bool ::boost::filesystem::is_match(const fs::path & ph, const char
*pattern)

2) boost::filesystem::file_dates(): Get the file dates for a given file
represented by a path object. The function throws a
boost::filesystem::filesystem_error object if ph does not exists or is
not a path to a file. You must define the macro
BOOST_FILESYSTEM_FILEDATES and link with the correct boost::date_time
library in order to use file_dates() function. file_dates() fills in and
returns a structure as follows:

struct filedates
{
  boost::posix_time::ptime m_file_created;
  boost::posix_time::ptime m_file_last_accessed;
  boost::posix_time::ptime m_file_last_modified;
};

filedates ::boost::filesystem::file_dates(const fs::path & ph);

Note: I have not yet had the time to test this under anything other than
VC++ 6.0 (yikes! yea I know - sorry) but if nobody else does this, I'll
test it under Linux RH9/gcc3.2 (and HP-UX 11/aCC if I find the time)
sometimes in the next week or so.

Pete

> -----Original Message-----
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Pete
> Sent: Tuesday, 16 November 2004 9:52 AM
> To: boost-users_at_[hidden]
> Subject: [Boost-users] boost::filesystem::path - where are
> the attributes?
>
>
> I'm not sure if I'm missing something or not, but I couldn't
> find anything in the filesystem documentation that allows one
> to retrieve file/directory attributes such as:
>
> Date created/last accessed/last modified
> Hidden
> System
> Read Only
> Link
> Etc.
>
> I'm particularly interested in portable file date accessors
> (hoping to find methods in the path class returning
> boost::posix_time::ptime). Are there any known workarounds?
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/bo> ost-users
>
>




Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net