Show error message on pre-10 Windows

This commit is contained in:
Sebastian Messmer 2018-12-14 00:40:38 -08:00
parent d68247070f
commit 2648dd81ee

View File

@ -5,6 +5,7 @@
#if defined(_MSC_VER) #if defined(_MSC_VER)
#include <cpp-utils/network/WinHttpClient.h> #include <cpp-utils/network/WinHttpClient.h>
#include <VersionHelpers.h>
#else #else
#include <cpp-utils/network/CurlHttpClient.h> #include <cpp-utils/network/CurlHttpClient.h>
#endif #endif
@ -18,12 +19,18 @@ using std::make_shared;
using std::cerr; using std::cerr;
int main(int argc, const char *argv[]) { int main(int argc, const char *argv[]) {
#if defined(_MSC_VER)
if (!IsWindows10OrGreater()) {
std::cerr << "CryFS is currently only supported on Windows 10 (or later)." << std::endl;
}
#endif
try { try {
auto &keyGenerator = Random::OSRandom(); auto &keyGenerator = Random::OSRandom();
#if defined(_MSC_VER) #if defined(_MSC_VER)
auto httpClient = make_unique_ref<cpputils::WinHttpClient>(); auto httpClient = make_unique_ref<cpputils::WinHttpClient>();
#else #else
auto httpClient = make_unique_ref<cpputils::CurlHttpClient>(); auto httpClient = make_unique_ref<cpputils::CurlHttpClient>();
#endif #endif
return Cli(keyGenerator, SCrypt::DefaultSettings, make_shared<IOStreamConsole>()) return Cli(keyGenerator, SCrypt::DefaultSettings, make_shared<IOStreamConsole>())
.main(argc, argv, std::move(httpClient), []{}); .main(argc, argv, std::move(httpClient), []{});