mirror of
https://github.com/LongSoft/UEFITool.git
synced 2025-05-25 12:34:54 -04:00
Fix more builder issues and perform the initial UEFIReplace port
This commit is contained in:
parent
2d02eeab6d
commit
0169c8c904
17 changed files with 402 additions and 61 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue