]> git.tdb.fi Git - libs/core.git/blob - source/dir.h
53228ccd760ce233d235fbef7b13b4b965c5c28b
[libs/core.git] / source / dir.h
1 /* $Id$
2
3 This file is part of libmspfs
4 Copyright © 2006-2008  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_FS_DIR_H_
9 #define MSP_FS_DIR_H_
10
11 #include <list>
12 #include <string>
13 #include "path.h"
14
15 namespace Msp {
16 namespace FS {
17
18 /// Creates a directory
19 void mkdir(const Path &path, int mode);
20
21 /// Creates a directory and any required parent directories
22 void mkpath(const Path &path, int mode);
23
24 /// Removes a directory, which must be empty
25 void rmdir(const Path &path);
26
27 /// Removes a directory and anything it contains
28 void rmpath(const Path &path);
29
30 /// Lists the contents of a directory
31 std::list<std::string> list_files(const Path &path);
32
33 /// Lists the contents of a directory, filtered with a regex
34 std::list<std::string> list_filtered(const Path &path, const std::string &filter);
35
36 /// Returns the current working directory
37 Path getcwd();
38
39 /// Returns the user's home directory
40 Path get_home_dir();
41
42 /// Returns a directory suitable for storing user-specific data
43 Path get_user_data_dir(const std::string &appname);
44
45 /// Returns a directory containing system-wide configuration
46 Path get_sys_conf_dir(const std::string &argv0);
47
48 /// Returns a directory containing immutable system-wide data
49 Path get_sys_data_dir(const std::string &argv0, const std::string &appname);
50
51 /// Returns a directory containing system-wide architecture-specific files
52 Path get_sys_lib_dir(const std::string &argv0, const std::string &appname);
53
54 /// Changes the current working directory
55 void chdir(const Path &);
56
57 } // namespace FS
58 } // namespace Msp
59
60 #endif