aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/vcpkg_metrics_uploader.cpp
blob: cef4f4756bc94b9fe350f77cd21446b4e7aa97f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "metrics.h"
#include "vcpkg_Checks.h"
#include "vcpkg_Files.h"
#include <Windows.h>

using namespace vcpkg;

int WINAPI WinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPSTR, _In_ int)
{
    int argCount;
    LPWSTR* szArgList = CommandLineToArgvW(GetCommandLineW(), &argCount);

    Checks::check_exit(VCPKG_LINE_INFO, argCount == 2, "Requires exactly one argument, the path to the payload file");
    auto v = Files::get_real_filesystem().read_contents(szArgList[1]).value_or_exit(VCPKG_LINE_INFO);
    Metrics::g_metrics.lock()->upload(v);
    LocalFree(szArgList);
    return 0;
}