]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/filesys.h
Make fs::extractZipFile thread-safe
[dragonfireclient.git] / src / filesys.h
index cfbfa02bfa0fa13563440781fd4f20497fca5c8e..233e56bba4cb2823f63bcc11d829652ec3197ee9 100644 (file)
@@ -24,18 +24,22 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include <vector>
 #include "exceptions.h"
 
-#ifdef _WIN32 // WINDOWS
+#ifdef _WIN32
 #define DIR_DELIM "\\"
 #define DIR_DELIM_CHAR '\\'
 #define FILESYS_CASE_INSENSITIVE true
 #define PATH_DELIM ";"
-#else // POSIX
+#else
 #define DIR_DELIM "/"
 #define DIR_DELIM_CHAR '/'
 #define FILESYS_CASE_INSENSITIVE false
 #define PATH_DELIM ":"
 #endif
 
+namespace irr { namespace io {
+class IFileSystem;
+}}
+
 namespace fs
 {
 
@@ -67,6 +71,10 @@ bool DeleteSingleFileOrEmptyDirectory(const std::string &path);
 // Returns path to temp directory, can return "" on error
 std::string TempPath();
 
+// Returns path to securely-created temporary file (will already exist when this function returns)
+// can return "" on error
+std::string CreateTempFile();
+
 /* Returns a list of subdirectories, including the path itself, but excluding
        hidden directories (whose names start with . or _)
 */
@@ -125,6 +133,10 @@ const char *GetFilenameFromPath(const char *path);
 
 bool safeWriteToFile(const std::string &path, const std::string &content);
 
+#ifndef SERVER
+bool extractZipFile(irr::io::IFileSystem *fs, const char *filename, const std::string &destination);
+#endif
+
 bool ReadFile(const std::string &path, std::string &out);
 
 bool Rename(const std::string &from, const std::string &to);