summaryrefslogtreecommitdiff
path: root/src/common/file_util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/file_util.h')
-rw-r--r--src/common/file_util.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/common/file_util.h b/src/common/file_util.h
index 090907c03..abfa79eae 100644
--- a/src/common/file_util.h
+++ b/src/common/file_util.h
@@ -9,6 +9,7 @@
9#include <fstream> 9#include <fstream>
10#include <functional> 10#include <functional>
11#include <string> 11#include <string>
12#include <string_view>
12#include <type_traits> 13#include <type_traits>
13#include <vector> 14#include <vector>
14#include "common/common_types.h" 15#include "common/common_types.h"
@@ -151,22 +152,22 @@ void SplitFilename83(const std::string& filename, std::array<char, 9>& short_nam
151 152
152// Splits the path on '/' or '\' and put the components into a vector 153// Splits the path on '/' or '\' and put the components into a vector
153// i.e. "C:\Users\Yuzu\Documents\save.bin" becomes {"C:", "Users", "Yuzu", "Documents", "save.bin" } 154// i.e. "C:\Users\Yuzu\Documents\save.bin" becomes {"C:", "Users", "Yuzu", "Documents", "save.bin" }
154std::vector<std::string> SplitPathComponents(const std::string& filename); 155std::vector<std::string> SplitPathComponents(std::string_view filename);
155 156
156// Gets all of the text up to the last '/' or '\' in the path. 157// Gets all of the text up to the last '/' or '\' in the path.
157std::string GetParentPath(const std::string& path); 158std::string_view GetParentPath(std::string_view path);
158 159
159// Gets all of the text after the first '/' or '\' in the path. 160// Gets all of the text after the first '/' or '\' in the path.
160std::string GetPathWithoutTop(std::string path); 161std::string_view GetPathWithoutTop(std::string_view path);
161 162
162// Gets the filename of the path 163// Gets the filename of the path
163std::string GetFilename(std::string path); 164std::string_view GetFilename(std::string_view path);
164 165
165// Gets the extension of the filename 166// Gets the extension of the filename
166std::string GetExtensionFromFilename(const std::string& name); 167std::string_view GetExtensionFromFilename(std::string_view name);
167 168
168// Removes the final '/' or '\' if one exists 169// Removes the final '/' or '\' if one exists
169std::string RemoveTrailingSlash(const std::string& path); 170std::string_view RemoveTrailingSlash(std::string_view path);
170 171
171// Creates a new vector containing indices [first, last) from the original. 172// Creates a new vector containing indices [first, last) from the original.
172template <typename T> 173template <typename T>