diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2017-02-28 18:36:37 -0800 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2017-02-28 18:36:37 -0800 |
| commit | b2cf02b2d6ccbe1e86620ce712501e8a173a701d (patch) | |
| tree | 6b835be9fa3d019743b10385afdd26684fa906da | |
| parent | 56d322dcb12dfaf95cd3cb9976110aa7d0cc9a15 (diff) | |
| download | vcpkg-b2cf02b2d6ccbe1e86620ce712501e8a173a701d.tar.gz vcpkg-b2cf02b2d6ccbe1e86620ce712501e8a173a701d.zip | |
Remove fs::exists() call
| -rw-r--r-- | toolsrc/src/commands_integrate.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/toolsrc/src/commands_integrate.cpp b/toolsrc/src/commands_integrate.cpp index 3d5a9daeb..edb35d33a 100644 --- a/toolsrc/src/commands_integrate.cpp +++ b/toolsrc/src/commands_integrate.cpp @@ -166,20 +166,17 @@ namespace vcpkg::Commands::Integrate fs::create_directory(tmp_dir); bool should_install_system = true; - if (fs::exists(system_wide_targets_file)) + const expected<std::string> system_wide_file_contents = Files::read_contents(system_wide_targets_file); + if (auto contents_data = system_wide_file_contents.get()) { - auto system_wide_file_contents = Files::read_contents(system_wide_targets_file); - if (auto contents_data = system_wide_file_contents.get()) + std::regex re(R"###(<!-- version (\d+) -->)###"); + std::match_results<std::string::const_iterator> match; + auto found = std::regex_search(*contents_data, match, re); + if (found) { - std::regex re(R"###(<!-- version (\d+) -->)###"); - std::match_results<std::string::const_iterator> match; - auto found = std::regex_search(*contents_data, match, re); - if (found) - { - int ver = atoi(match[1].str().c_str()); - if (ver >= 1) - should_install_system = false; - } + int ver = atoi(match[1].str().c_str()); + if (ver >= 1) + should_install_system = false; } } |
