diff options
Diffstat (limited to 'src/common/file_util.h')
-rw-r--r-- | src/common/file_util.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/common/file_util.h b/src/common/file_util.h index c7e11ec0..173ce662 100644 --- a/src/common/file_util.h +++ b/src/common/file_util.h @@ -4,11 +4,12 @@ #pragma once +#include <array> #include <fstream> #include <cstdio> +#include <cstring> #include <string> #include <vector> -#include <string.h> #include "common/common.h" #include "common/string_util.h" @@ -128,8 +129,18 @@ std::string GetBundleDirectory(); std::string &GetExeDirectory(); #endif -bool WriteStringToFile(bool text_file, const std::string &str, const char *filename); -bool ReadFileToString(bool text_file, const char *filename, std::string &str); +size_t WriteStringToFile(bool text_file, const std::string &str, const char *filename); +size_t ReadFileToString(bool text_file, const char *filename, std::string &str); + +/** + * Splits the filename into 8.3 format + * Loosely implemented following https://en.wikipedia.org/wiki/8.3_filename + * @param filename The normal filename to use + * @param short_name A 9-char array in which the short name will be written + * @param extension A 4-char array in which the extension will be written + */ +void SplitFilename83(const std::string& filename, std::array<char, 9>& short_name, + std::array<char, 4>& extension); // simple wrapper for cstdlib file functions to // hopefully will make error checking easier |