7 #include <msp/core/attributes.h>
13 class not_a_directory: public std::runtime_error
16 not_a_directory(const Path &);
17 virtual ~not_a_directory() throw() { }
20 /// Creates a directory
21 void mkdir(const Path &path, int mode);
23 /// Creates a directory and any required parent directories
24 void mkpath(const Path &path, int mode);
26 /// Removes a directory, which must be empty
27 void rmdir(const Path &path);
29 /// Removes a directory and anything it contains
30 void rmpath(const Path &path);
32 /// Lists the contents of a directory
33 std::list<std::string> list_files(const Path &path);
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);
38 /// Returns the current working directory
41 /// Changes the current working directory
42 void chdir(const Path &);
44 /// Returns the user's home directory
47 /// Deprecated. Use the argument-less version instead.
48 DEPRECATED Path get_user_data_dir(const std::string &appname);
50 /// Returns a directory suitable for storing user-specific data.
51 Path get_user_data_dir();
53 /// Deprecated. Use the argument-less version instead.
54 DEPRECATED Path get_sys_conf_dir(const std::string &argv0);
56 /// Returns a directory containing system-wide configuration.
57 Path get_sys_conf_dir();
59 /// Deprecated. Use the argument-less version instead.
60 DEPRECATED Path get_sys_data_dir(const std::string &argv0, const std::string &appname);
62 /// Returns a directory containing immutable system-wide data.
63 Path get_sys_data_dir();
65 /// Deprecated. Use the argument-less version instead.
66 DEPRECATED Path get_sys_lib_dir(const std::string &argv0, const std::string &appname);
68 /// Returns a directory containing system-wide architecture-specific files.
69 Path get_sys_lib_dir();
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> &);
75 /** Looks for a file using the PATH environment variable. */
76 Path path_lookup(const std::string &);