Translated using Weblate (Italian)
[oweals/minetest.git] / src / filesys.cpp
index f61b39b9465b191badf70befdb27da41e27b13f5..0bc351669d0e744f5255648c0dd0e37ec94fcb31 100644 (file)
@@ -691,6 +691,12 @@ std::string AbsolutePath(const std::string &path)
 const char *GetFilenameFromPath(const char *path)
 {
        const char *filename = strrchr(path, DIR_DELIM_CHAR);
+       // Consistent with IsDirDelimiter this function handles '/' too
+       if (DIR_DELIM_CHAR != '/') {
+               const char *tmp = strrchr(path, '/');
+               if (tmp && tmp > filename)
+                       filename = tmp;
+       }
        return filename ? filename + 1 : path;
 }