X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fstat.h;fp=source%2Fstat.h;h=f6b13d431a340cddd256336a6e676e668f00c462;hb=f91f1df3e0b00b3a270e571d4b2c8251da4d1226;hp=0000000000000000000000000000000000000000;hpb=e6fec68039fb5212993d687d352c540e407e6d96;p=libs%2Fcore.git diff --git a/source/stat.h b/source/stat.h new file mode 100644 index 0000000..f6b13d4 --- /dev/null +++ b/source/stat.h @@ -0,0 +1,40 @@ +/* $Id$ + +This file is part of libmspfs +Copyright © 2006-2008 Mikko Rasa, Mikkosoft Productions +Distributed under the LGPL +*/ + +#ifndef MSP_FS_STAT_H_ +#define MSP_FS_STAT_H_ + +#include + +namespace Msp { +namespace FS { + +class Path; + +/** +Gets information about a file. Returns 0 on success or -1 on error. This +version can be used to check for file existence and get information in one +call. +*/ +int stat(const Path &fn, struct stat &st); + +/** +Returns information about a file. This version throws an exception if an error +occurs. +*/ +struct stat stat(const Path &fn); + +/// Tests for existence of a file +bool exists(const Path &path); + +/// Tests whether a path refers to an existing directory +bool is_dir(const Path &path); + +} // namespace FS +} // namespace Msp + +#endif