diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 102efc78dd..f74b5bbe1f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -368,7 +368,7 @@ jobs: steps: - name: Set up MSBuild uses: microsoft/setup-msbuild@v1.0.2 - - name: Setup VSTest.console.exe + - name: Set up VSTest.console.exe uses: darenm/Setup-VSTest@v1 - name: Set up Node.js uses: actions/setup-node@v1 diff --git a/windows/ReactTestApp/Manifest.cpp b/windows/ReactTestApp/Manifest.cpp index 537b905aa3..8709dc8264 100644 --- a/windows/ReactTestApp/Manifest.cpp +++ b/windows/ReactTestApp/Manifest.cpp @@ -9,8 +9,7 @@ #include "Manifest.h" -#include -#include +#include #include #include @@ -116,16 +115,18 @@ namespace ReactTestApp std::optional> GetManifest(std::string const &filename) { - std::string json; - { - std::ifstream stream(filename); + std::FILE *stream = nullptr; + if (std::fopen_s(&stream, filename.c_str(), "rb") != 0) { + return std::nullopt; + } - stream.seekg(0, std::ios::end); - json.reserve(static_cast(stream.tellg())); + std::string json; + std::fseek(stream, 0, SEEK_END); + json.resize(std::ftell(stream)); - stream.seekg(0, std::ios::beg); - json.assign(std::istreambuf_iterator(stream), {}); - } + std::rewind(stream); + std::fread(json.data(), 1, json.size(), stream); + std::fclose(stream); auto j = nlohmann::json::parse(json, nullptr, false); if (j.is_discarded()) {