]> git.tdb.fi Git - libs/core.git/blob - source/fs/stat.h
Merge branch 'fs-master'
[libs/core.git] / source / fs / stat.h
1 #ifndef MSP_FS_STAT_H_
2 #define MSP_FS_STAT_H_
3
4 #include <sys/stat.h>
5 #include "path.h"
6
7 namespace Msp {
8 namespace FS {
9
10 /** Gets information about a file.  Returns 0 on success or -1 on error.  This
11 version can be used to check for file existence and get information in one
12 call. */
13 int stat(const Path &fn, struct stat &st);
14
15 /** Returns information about a file.  This version throws an exception if an
16 error occurs. */
17 struct stat stat(const Path &fn);
18
19 /// Gets information about a file, without following symbolic links
20 int lstat(const Path &fn, struct stat &st);
21
22 /// Returns information about a file, without following symbolic links
23 struct stat lstat(const Path &fn);
24
25 /// Tests for existence of a file
26 bool exists(const Path &path);
27
28 /// Tests whether a path refers to an existing regular file
29 bool is_reg(const Path &path);
30
31 /// Tests whether a path refers to an existing directory
32 bool is_dir(const Path &path);
33
34 /// Tests whether a path refers to a symbolic link
35 bool is_link(const Path &path);
36
37 } // namespace FS
38 } // namespace Msp
39
40 #endif