]> git.lizzy.rs Git - minetest.git/blobdiff - src/util/string.h
Add sound to press event of some formspecs elements (#10402)
[minetest.git] / src / util / string.h
index 185fb55e2401e994dbb8c05c37ebdf047dd4bc79..6fd11fadce21e65d0498f2e28a56b91a65df1d3d 100644 (file)
@@ -746,3 +746,11 @@ inline irr::core::stringw utf8_to_stringw(const std::string &input)
        std::wstring str = utf8_to_wide(input);
        return irr::core::stringw(str.c_str());
 }
+
+/**
+ * Sanitize the name of a new directory. This consists of two stages:
+ * 1. Check for 'reserved filenames' that can't be used on some filesystems
+ *    and prefix them
+ * 2. Remove 'unsafe' characters from the name by replacing them with '_'
+ */
+std::string sanitizeDirName(const std::string &str, const std::string &optional_prefix);