diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2017-04-14 16:07:54 -0700 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2017-04-14 16:07:54 -0700 |
| commit | 20397fc845fac398a1aca2ee17ce5b932fc1a83b (patch) | |
| tree | 51235bc2602a81a89da9605272a37ca4fc1765a8 /toolsrc/src/metrics.cpp | |
| parent | 8183671a492aa21ec20780a77f923848b0aeca41 (diff) | |
| parent | 1c08a42091cb0addd1e0c1daf27d24bf4e9d237f (diff) | |
| download | vcpkg-20397fc845fac398a1aca2ee17ce5b932fc1a83b.tar.gz vcpkg-20397fc845fac398a1aca2ee17ce5b932fc1a83b.zip | |
Merge branch 'dev/roschuma/fs-testing'
Diffstat (limited to 'toolsrc/src/metrics.cpp')
| -rw-r--r-- | toolsrc/src/metrics.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/toolsrc/src/metrics.cpp b/toolsrc/src/metrics.cpp index 515d7e574..baefc3c35 100644 --- a/toolsrc/src/metrics.cpp +++ b/toolsrc/src/metrics.cpp @@ -3,6 +3,7 @@ #include "filesystem_fs.h" #include "vcpkg_Strings.h" #include "vcpkg_System.h" +#include "vcpkg_Files.h" namespace vcpkg::Metrics { @@ -385,30 +386,32 @@ true const fs::path temp_folder_path = temp_folder; const fs::path temp_folder_path_exe = temp_folder_path / "vcpkgmetricsuploader.exe"; + auto& fs = Files::get_real_filesystem(); + if (true) { - const fs::path exe_path = []() -> fs::path + const fs::path exe_path = [&fs]() -> fs::path { auto vcpkgdir = get_bindir().parent_path(); auto path = vcpkgdir / "vcpkgmetricsuploader.exe"; - if (fs::exists(path)) + if (fs.exists(path)) return path; path = vcpkgdir / "scripts" / "vcpkgmetricsuploader.exe"; - if (fs::exists(path)) + if (fs.exists(path)) return path; return L""; }(); std::error_code ec; - fs::copy_file(exe_path, temp_folder_path_exe, fs::copy_options::skip_existing, ec); + fs.copy_file(exe_path, temp_folder_path_exe, fs::copy_options::skip_existing, ec); if (ec) return; } const fs::path vcpkg_metrics_txt_path = temp_folder_path / ("vcpkg" + generate_random_UUID() + ".txt"); - std::ofstream(vcpkg_metrics_txt_path) << payload; + fs.write_contents(vcpkg_metrics_txt_path, payload); const std::wstring cmdLine = Strings::wformat(L"start %s %s", temp_folder_path_exe.native(), vcpkg_metrics_txt_path.native()); System::cmd_execute_clean(cmdLine); |
