12 class not_a_directory: public std::runtime_error
15 not_a_directory(const Path &);
16 virtual ~not_a_directory() throw() = default;
19 /// Creates a directory
20 void mkdir(const Path &path, int mode);
22 /// Creates a directory and any required parent directories
23 void mkpath(const Path &path, int mode);
25 /// Removes a directory, which must be empty
26 void rmdir(const Path &path);
28 /// Removes a directory and anything it contains
29 void rmpath(const Path &path);
31 /// Lists the contents of a directory
32 std::vector<std::string> list_files(const Path &path);
34 /// Lists the contents of a directory, filtered with a regex
35 std::vector<std::string> list_filtered(const Path &path, const std::string &filter);
37 /// Returns the current working directory
40 /// Changes the current working directory
41 void chdir(const Path &);
43 /// Returns the user's home directory
46 /// Returns a directory suitable for storing user-specific data.
47 Path get_user_data_dir();
49 /// Returns a directory containing system-wide configuration.
50 Path get_sys_conf_dir();
52 /// Returns a directory containing immutable system-wide data.
53 Path get_sys_data_dir();
55 /// Returns a directory containing system-wide architecture-specific files.
56 Path get_sys_lib_dir();
58 /** Looks for a file in a list of paths. Returns the absolute path to the
59 first existing location, or an empty Path if the file is not found at all. */
60 Path path_lookup(const std::string &, const std::vector<Path> &);
62 /** Looks for a file using the PATH environment variable. */
63 Path path_lookup(const std::string &);