Fix more builder issues and perform the initial UEFIReplace port

This commit is contained in:
vit9696 2018-09-01 10:29:46 +03:00
parent 2d02eeab6d
commit 0169c8c904
17 changed files with 402 additions and 61 deletions

View file

@ -16,7 +16,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "basetypes.h"
#include "ustring.h"
#include "ubytearray.h"
#include <sys/stat.h>
#include <fstream>
#ifdef WIN32
#include <direct.h>
@ -48,4 +50,20 @@ static inline bool changeDirectory(const UString & dir) {
}
#endif
static inline USTATUS readFileIntoArray(const UString & inPath, UByteArray &array) {
if (!isExistOnFs(inPath))
return U_FILE_OPEN;
std::ifstream inputFile(inPath.toLocal8Bit(), std::ios::in | std::ios::binary);
if (!inputFile)
return U_FILE_OPEN;
std::vector<char> buffer(std::istreambuf_iterator<char>(inputFile),
(std::istreambuf_iterator<char>()));
inputFile.close();
array = buffer;
return U_SUCCESS;
}
#endif