summaryrefslogtreecommitdiffhomepage
path: root/windows
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2019-11-05 10:39:34 +0100
committerDavid Lönnhager <david.l@mullvad.net>2019-11-18 13:24:18 +0100
commit2a119a446e41676e75fa7cd55bc92ebf10f671cd (patch)
treeb8dd6e8ab7c5867f5e3d7724083ee5d850aebff1 /windows
parent174fa135f2a6f19aad5982e4e1e909aae4c71c3b (diff)
downloadmullvadvpn-2a119a446e41676e75fa7cd55bc92ebf10f671cd.tar.xz
mullvadvpn-2a119a446e41676e75fa7cd55bc92ebf10f671cd.zip
Use std::filesystem in nsis-plugins
Diffstat (limited to 'windows')
-rw-r--r--windows/nsis-plugins/src/cleanup/cleaningops.cpp36
-rw-r--r--windows/nsis-plugins/src/log/log.cpp6
-rw-r--r--windows/nsis-plugins/src/tray/tray.cpp4
3 files changed, 23 insertions, 23 deletions
diff --git a/windows/nsis-plugins/src/cleanup/cleaningops.cpp b/windows/nsis-plugins/src/cleanup/cleaningops.cpp
index dec5ec198f..671ff3c73d 100644
--- a/windows/nsis-plugins/src/cleanup/cleaningops.cpp
+++ b/windows/nsis-plugins/src/cleanup/cleaningops.cpp
@@ -6,7 +6,7 @@
#include <libcommon/memory.h>
#include <libcommon/security.h>
#include <libcommon/process.h>
-#include <experimental/filesystem>
+#include <filesystem>
#include <utility>
#include <functional>
#include <processthreadsapi.h>
@@ -49,7 +49,7 @@ mirrored_range
std::wstring ConstructLocalAppDataPath(const std::wstring &base, const std::wstring &user,
const std::pair<std::vector<std::wstring>::iterator, std::vector<std::wstring>::iterator> &tokens)
{
- auto path = std::experimental::filesystem::path(base);
+ auto path = std::filesystem::path(base);
path.append(user);
@@ -73,7 +73,7 @@ std::wstring GetSystemUserLocalAppData()
};
auto systemDir = common::fs::GetKnownFolderPath(FOLDERID_System, KF_FLAG_DEFAULT, NULL);
- auto lsassPath = std::experimental::filesystem::path(systemDir).append(L"lsass.exe");
+ auto lsassPath = std::filesystem::path(systemDir).append(L"lsass.exe");
auto lsassPid = common::process::GetProcessIdFromName(lsassPath);
auto processHandle = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, lsassPid);
@@ -110,9 +110,9 @@ namespace cleaningops
void RemoveLogsCacheCurrentUser()
{
const auto localAppData = common::fs::GetKnownFolderPath(FOLDERID_LocalAppData, KF_FLAG_DEFAULT, nullptr);
- const auto appdir = std::experimental::filesystem::path(localAppData).append(L"Mullvad VPN");
+ const auto appdir = std::filesystem::path(localAppData).append(L"Mullvad VPN");
- std::experimental::filesystem::remove_all(appdir);
+ std::filesystem::remove_all(appdir);
}
void RemoveLogsCacheOtherUsers()
@@ -181,25 +181,25 @@ void RemoveLogsCacheOtherUsers()
while (files.next(file))
{
const auto userLocalAppData = ConstructLocalAppDataPath(files.getDirectory(), file.cFileName, relativeLocalAppData);
- const auto target = std::experimental::filesystem::path(userLocalAppData).append(L"Mullvad VPN");
+ const auto target = std::filesystem::path(userLocalAppData).append(L"Mullvad VPN");
std::error_code dummy;
- std::experimental::filesystem::remove_all(target, dummy);
+ std::filesystem::remove_all(target, dummy);
}
}
void RemoveLogsServiceUser()
{
const auto programData = common::fs::GetKnownFolderPath(FOLDERID_ProgramData, KF_FLAG_DEFAULT, nullptr);
- const auto appdir = std::experimental::filesystem::path(programData).append(L"Mullvad VPN");
+ const auto appdir = std::filesystem::path(programData).append(L"Mullvad VPN");
- std::experimental::filesystem::remove_all(appdir);
+ std::filesystem::remove_all(appdir);
}
void RemoveCacheServiceUser()
{
const auto localAppData = GetSystemUserLocalAppData();
- const auto mullvadAppData = std::experimental::filesystem::path(localAppData).append(L"Mullvad VPN");
+ const auto mullvadAppData = std::filesystem::path(localAppData).append(L"Mullvad VPN");
common::fs::ScopedNativeFileSystem nativeFileSystem;
@@ -220,10 +220,10 @@ void RemoveCacheServiceUser()
while (files.next(file))
{
- const auto target = std::experimental::filesystem::path(files.getDirectory()).append(file.cFileName);
+ const auto target = std::filesystem::path(files.getDirectory()).append(file.cFileName);
std::error_code dummy;
- std::experimental::filesystem::remove(target, dummy);
+ std::filesystem::remove(target, dummy);
}
}
@@ -237,7 +237,7 @@ void RemoveCacheServiceUser()
void RemoveSettingsServiceUser()
{
const auto localAppData = GetSystemUserLocalAppData();
- const auto mullvadAppData = std::experimental::filesystem::path(localAppData).append(L"Mullvad VPN");
+ const auto mullvadAppData = std::filesystem::path(localAppData).append(L"Mullvad VPN");
common::fs::ScopedNativeFileSystem nativeFileSystem;
@@ -258,10 +258,10 @@ void RemoveSettingsServiceUser()
while (files.next(file))
{
- const auto target = std::experimental::filesystem::path(files.getDirectory()).append(file.cFileName);
+ const auto target = std::filesystem::path(files.getDirectory()).append(file.cFileName);
std::error_code dummy;
- std::experimental::filesystem::remove(target, dummy);
+ std::filesystem::remove(target, dummy);
}
}
@@ -275,15 +275,15 @@ void RemoveSettingsServiceUser()
void RemoveRelayCacheServiceUser()
{
const auto localAppData = GetSystemUserLocalAppData();
- const auto mullvadAppData = std::experimental::filesystem::path(localAppData).append(L"Mullvad VPN");
+ const auto mullvadAppData = std::filesystem::path(localAppData).append(L"Mullvad VPN");
common::fs::ScopedNativeFileSystem nativeFileSystem;
common::security::AddAdminToObjectDacl(mullvadAppData, SE_FILE_OBJECT);
- const auto cacheFile = std::experimental::filesystem::path(mullvadAppData).append(L"relays.json");
+ const auto cacheFile = std::filesystem::path(mullvadAppData).append(L"relays.json");
- std::experimental::filesystem::remove(cacheFile);
+ std::filesystem::remove(cacheFile);
}
}
diff --git a/windows/nsis-plugins/src/log/log.cpp b/windows/nsis-plugins/src/log/log.cpp
index f0a050aadb..7b58006064 100644
--- a/windows/nsis-plugins/src/log/log.cpp
+++ b/windows/nsis-plugins/src/log/log.cpp
@@ -12,7 +12,7 @@
#include <memory>
#include <sstream>
#include <iomanip>
-#include <experimental/filesystem>
+#include <filesystem>
Logger *g_logger = nullptr;
@@ -94,7 +94,7 @@ std::wstring GetWindowsVersion()
common::fs::ScopedNativeFileSystem nativeFileSystem;
const auto systemDir = common::fs::GetKnownFolderPath(FOLDERID_System, 0, nullptr);
- const auto systemModule = std::experimental::filesystem::path(systemDir).append(L"ntoskrnl.exe");
+ const auto systemModule = std::filesystem::path(systemDir).append(L"ntoskrnl.exe");
DWORD dummy;
@@ -199,7 +199,7 @@ void __declspec(dllexport) NSISCALL Initialize
{
case static_cast<int>(LogTarget::LOG_FILE):
{
- auto logpath = std::experimental::filesystem::path(common::fs::GetKnownFolderPath(
+ auto logpath = std::filesystem::path(common::fs::GetKnownFolderPath(
FOLDERID_ProgramData, 0, nullptr));
logpath.append(L"Mullvad VPN");
diff --git a/windows/nsis-plugins/src/tray/tray.cpp b/windows/nsis-plugins/src/tray/tray.cpp
index f270c47261..3e52ea6e1e 100644
--- a/windows/nsis-plugins/src/tray/tray.cpp
+++ b/windows/nsis-plugins/src/tray/tray.cpp
@@ -12,7 +12,7 @@
#include <libcommon/security.h>
#include <nsis/pluginapi.h>
#include <stdexcept>
-#include <experimental/filesystem>
+#include <filesystem>
namespace
{
@@ -47,7 +47,7 @@ void UpdateRegistry(common::registry::RegistryKey &regkey, const std::wstring &v
//
const auto windir = common::fs::GetKnownFolderPath(FOLDERID_Windows, 0, nullptr);
- const auto explorer = std::experimental::filesystem::path(windir).append(L"explorer.exe");
+ const auto explorer = std::filesystem::path(windir).append(L"explorer.exe");
//
// Determine process id of active instance(s).