summaryrefslogtreecommitdiff
path: root/src/filesys.cpp
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2015-04-26 01:24:19 -0400
committerkwolekr <kwolekr@minetest.net>2015-04-26 15:08:54 -0400
commit7220ca906dfc804bd508336f5bed252bcec62ae0 (patch)
tree6a61f536227510a57b023019271084450042a7ad /src/filesys.cpp
parent45a77c8bf1a744edc1642d717579281cf988f8dd (diff)
downloadminetest-7220ca906dfc804bd508336f5bed252bcec62ae0.tar.gz
minetest-7220ca906dfc804bd508336f5bed252bcec62ae0.tar.bz2
minetest-7220ca906dfc804bd508336f5bed252bcec62ae0.zip
Tests: Modularize unit testing
Split unit tests into separate files under src/unittest/ Give better unittest diagnostics Clean up some code
Diffstat (limited to 'src/filesys.cpp')
-rw-r--r--src/filesys.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/filesys.cpp b/src/filesys.cpp
index 3630df46b..4a4a2e418 100644
--- a/src/filesys.cpp
+++ b/src/filesys.cpp
@@ -662,6 +662,12 @@ std::string RemoveRelativePathComponents(std::string path)
return path.substr(0, pos);
}
+const char *GetFilenameFromPath(const char *path)
+{
+ const char *filename = strrchr(path, DIR_DELIM_CHAR);
+ return filename ? filename + 1 : path;
+}
+
bool safeWriteToFile(const std::string &path, const std::string &content)
{
std::string tmp_file = path + ".~mt";