]> git.tdb.fi Git - libs/core.git/blobdiff - source/fs/dir.h
Annotate deprecated functions as such
[libs/core.git] / source / fs / dir.h
index 53228ccd760ce233d235fbef7b13b4b965c5c28b..89d86ed9383c0f99661d80d1b169d82c87a2a585 100644 (file)
@@ -1,20 +1,22 @@
-/* $Id$
-
-This file is part of libmspfs
-Copyright © 2006-2008  Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
 #ifndef MSP_FS_DIR_H_
 #define MSP_FS_DIR_H_
 
 #include <list>
+#include <stdexcept>
 #include <string>
+#include <msp/core/attributes.h>
 #include "path.h"
 
 namespace Msp {
 namespace FS {
 
+class not_a_directory: public std::runtime_error
+{
+public:
+       not_a_directory(const Path &);
+       virtual ~not_a_directory() throw() { }
+};
+
 /// Creates a directory
 void mkdir(const Path &path, int mode);
 
@@ -36,23 +38,42 @@ std::list<std::string> list_filtered(const Path &path, const std::string &filter
 /// Returns the current working directory
 Path getcwd();
 
+/// Changes the current working directory
+void chdir(const Path &);
+
 /// Returns the user's home directory
 Path get_home_dir();
 
-/// Returns a directory suitable for storing user-specific data
-Path get_user_data_dir(const std::string &appname);
+/// Deprecated.  Use the argument-less version instead.
+DEPRECATED Path get_user_data_dir(const std::string &appname);
 
-/// Returns a directory containing system-wide configuration
-Path get_sys_conf_dir(const std::string &argv0);
+/// Returns a directory suitable for storing user-specific data.
+Path get_user_data_dir();
 
-/// Returns a directory containing immutable system-wide data
-Path get_sys_data_dir(const std::string &argv0, const std::string &appname);
+/// Deprecated.  Use the argument-less version instead.
+DEPRECATED Path get_sys_conf_dir(const std::string &argv0);
 
-/// Returns a directory containing system-wide architecture-specific files
-Path get_sys_lib_dir(const std::string &argv0, const std::string &appname);
+/// Returns a directory containing system-wide configuration.
+Path get_sys_conf_dir();
 
-/// Changes the current working directory
-void chdir(const Path &);
+/// Deprecated.  Use the argument-less version instead.
+DEPRECATED Path get_sys_data_dir(const std::string &argv0, const std::string &appname);
+
+/// Returns a directory containing immutable system-wide data.
+Path get_sys_data_dir();
+
+/// Deprecated.  Use the argument-less version instead.
+DEPRECATED Path get_sys_lib_dir(const std::string &argv0, const std::string &appname);
+
+/// Returns a directory containing system-wide architecture-specific files.
+Path get_sys_lib_dir();
+
+/** Looks for a file in a list of paths.  Returns the absolute path to the
+first existing location, or an empty Path if the file is not found at all. */
+Path path_lookup(const std::string &, const std::list<Path> &);
+
+/** Looks for a file using the PATH environment variable. */
+Path path_lookup(const std::string &);
 
 } // namespace FS
 } // namespace Msp