1
2
3
4
5
6 #ifndef SOULNG_UTIL_PATH_INCLUDED
7 #define SOULNG_UTIL_PATH_INCLUDED
8 #include <soulng/util/UtilApi.hpp>
9 #include <stdexcept>
10
11 namespace soulng { namespace util {
12
13 class InvalidPathException : public std::runtime_error
14 {
15 public:
16 InvalidPathException(const std::string& message_);
17 };
18
19 std::string GetCurrentWorkingDirectory();
20 bool FileExists(const std::string& filePath);
21 bool DirectoryExists(const std::string& directoryPath);
22 bool PathExists(const std::string& path);
23 std::string GetFullPath(const std::string& path);
24 std::string MakeRelativeDirPath(const std::string& dirPath, const std::string& referenceDirPath);
25
26 class Path
27 {
28 public:
29 static std::string MakeCanonical(const std::string& path);
30 static std::string ChangeExtension(const std::string& path, const std::string& extension);
31 static bool HasExtension(const std::string& path);
32 static std::string GetExtension(const std::string& path);
33 static std::string GetDrive(const std::string& path);
34 static std::string GetFileName(const std::string& path);
35 static std::string GetFileNameWithoutExtension(const std::string& path);
36 static std::string GetDirectoryName(const std::string& path);
37 static std::string Combine(const std::string& path1, const std::string& path2);
38 static bool IsAbsolute(const std::string& path);
39 static bool IsRelative(const std::string& path);
40 };
41
42 } }
43
44 #endif // SOULNG_UTIL_PATH_INCLUDED