Max OS 0.3
Loading...
Searching...
No Matches
path.h
Go to the documentation of this file.
1
9#ifndef MAXOS_FILESYSTEM_PATH_H
10#define MAXOS_FILESYSTEM_PATH_H
11
12#include <common/string.h>
13
14
15namespace MaxOS::filesystem {
16
21 class Path {
22 public:
23 static bool valid(const string& path);
24 static bool is_file(const string& path);
25
26 static string file_name(const string& path);
27 static string file_extension(const string& path);
28 static string file_path(const string& path);
29
30 static string top_directory(const string& path);
31 static string parent_directory(const string& path);
32
33 static string absolute_path(const string& path);
34 static string join_path(const string& base, const string& extended);
35 };
36
37
38}
39
40
41#endif //MAXOS_FILESYSTEM_PATH_H
Handles file & directory paths.
Definition path.h:21
static string file_extension(const string &path)
Try to get the file extension from a path (assumes split by ".")
Definition path.cpp:77
static string parent_directory(const string &path)
Get the parent directory of the path.
Definition path.cpp:148
static bool valid(const string &path)
Check if a path is valid.
Definition path.cpp:21
static bool is_file(const string &path)
Check if a path is a file.
Definition path.cpp:42
static string file_name(const string &path)
Get the file name component of a path if it exists or an empty string.
Definition path.cpp:54
static string top_directory(const string &path)
Get the top directory of a path.
Definition path.cpp:125
static string file_path(const string &path)
Finds the path to the directory the file is in.
Definition path.cpp:101
static string join_path(const string &base, const string &extended)
Joins two paths together.
Definition path.cpp:208
static string absolute_path(const string &path)
Calculates path with out any "../" or "./".
Definition path.cpp:170
Defines a String class for dynamically sized strings with various operations.