]> git.tdb.fi Git - libs/core.git/blob - source/fs/dir.h
Annotate deprecated functions as such
[libs/core.git] / source / fs / dir.h
1 #ifndef MSP_FS_DIR_H_
2 #define MSP_FS_DIR_H_
3
4 #include <list>
5 #include <stdexcept>
6 #include <string>
7 #include <msp/core/attributes.h>
8 #include "path.h"
9
10 namespace Msp {
11 namespace FS {
12
13 class not_a_directory: public std::runtime_error
14 {
15 public:
16         not_a_directory(const Path &);
17         virtual ~not_a_directory() throw() { }
18 };
19
20 /// Creates a directory
21 void mkdir(const Path &path, int mode);
22
23 /// Creates a directory and any required parent directories
24 void mkpath(const Path &path, int mode);
25
26 /// Removes a directory, which must be empty
27 void rmdir(const Path &path);
28
29 /// Removes a directory and anything it contains
30 void rmpath(const Path &path);
31
32 /// Lists the contents of a directory
33 std::list<std::string> list_files(const Path &path);
34
35 /// Lists the contents of a directory, filtered with a regex
36 std::list<std::string> list_filtered(const Path &path, const std::string &filter);
37
38 /// Returns the current working directory
39 Path getcwd();
40
41 /// Changes the current working directory
42 void chdir(const Path &);
43
44 /// Returns the user's home directory
45 Path get_home_dir();
46
47 /// Deprecated.  Use the argument-less version instead.
48 DEPRECATED Path get_user_data_dir(const std::string &appname);
49
50 /// Returns a directory suitable for storing user-specific data.
51 Path get_user_data_dir();
52
53 /// Deprecated.  Use the argument-less version instead.
54 DEPRECATED Path get_sys_conf_dir(const std::string &argv0);
55
56 /// Returns a directory containing system-wide configuration.
57 Path get_sys_conf_dir();
58
59 /// Deprecated.  Use the argument-less version instead.
60 DEPRECATED Path get_sys_data_dir(const std::string &argv0, const std::string &appname);
61
62 /// Returns a directory containing immutable system-wide data.
63 Path get_sys_data_dir();
64
65 /// Deprecated.  Use the argument-less version instead.
66 DEPRECATED Path get_sys_lib_dir(const std::string &argv0, const std::string &appname);
67
68 /// Returns a directory containing system-wide architecture-specific files.
69 Path get_sys_lib_dir();
70
71 /** Looks for a file in a list of paths.  Returns the absolute path to the
72 first existing location, or an empty Path if the file is not found at all. */
73 Path path_lookup(const std::string &, const std::list<Path> &);
74
75 /** Looks for a file using the PATH environment variable. */
76 Path path_lookup(const std::string &);
77
78 } // namespace FS
79 } // namespace Msp
80
81 #endif