summaryrefslogtreecommitdiff
path: root/src/filesys.cpp
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2014-09-05 20:08:51 -0400
committerShadowNinja <shadowninja@minetest.net>2015-05-16 18:32:31 -0400
commit3a8c7888807e4483bbdb3edd81c9893f3e2f427d (patch)
tree81f339e5f61b03e8d7842e06f034d09bf59dba96 /src/filesys.cpp
parentf26421228bbd31f02bf16b45a4b82be84f233e52 (diff)
downloadminetest-3a8c7888807e4483bbdb3edd81c9893f3e2f427d.tar.gz
minetest-3a8c7888807e4483bbdb3edd81c9893f3e2f427d.tar.bz2
minetest-3a8c7888807e4483bbdb3edd81c9893f3e2f427d.zip
Add mod security
Due to compatibility concerns, this is temporarily disabled.
Diffstat (limited to 'src/filesys.cpp')
-rw-r--r--src/filesys.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/filesys.cpp b/src/filesys.cpp
index 4a4a2e418..9aeecf427 100644
--- a/src/filesys.cpp
+++ b/src/filesys.cpp
@@ -662,6 +662,19 @@ std::string RemoveRelativePathComponents(std::string path)
return path.substr(0, pos);
}
+std::string AbsolutePath(const std::string &path)
+{
+#ifdef _WIN32
+ char *abs_path = _fullpath(NULL, path.c_str(), MAX_PATH);
+#else
+ char *abs_path = realpath(path.c_str(), NULL);
+#endif
+ if (!abs_path) return "";
+ std::string abs_path_str(abs_path);
+ free(abs_path);
+ return abs_path_str;
+}
+
const char *GetFilenameFromPath(const char *path)
{
const char *filename = strrchr(path, DIR_DELIM_CHAR);