From 277fa21f5f7dcdec1bde11f345136f464ee8d37a Mon Sep 17 00:00:00 2001 From: flow Date: Sun, 7 Aug 2022 07:18:37 -0300 Subject: [PATCH] refactor: remove Win32 'crap' in FileSystem We should use std::filesystem symlink and hardlink functions instead. Signed-off-by: flow --- launcher/FileSystem.cpp | 44 ----------------------------------------- 1 file changed, 44 deletions(-) diff --git a/launcher/FileSystem.cpp b/launcher/FileSystem.cpp index fefa6dd1..8966413a 100644 --- a/launcher/FileSystem.cpp +++ b/launcher/FileSystem.cpp @@ -300,50 +300,6 @@ bool checkProblemticPathJava(QDir folder) return pathfoldername.contains("!", Qt::CaseInsensitive); } -// Win32 crap -#ifdef Q_OS_WIN - -bool called_coinit = false; - -HRESULT CreateLink(LPCCH linkPath, LPCWSTR targetPath, LPCWSTR args) -{ - HRESULT hres; - - if (!called_coinit) { - hres = CoInitialize(NULL); - called_coinit = true; - - if (!SUCCEEDED(hres)) { - qWarning("Failed to initialize COM. Error 0x%08lX", hres); - return hres; - } - } - - IShellLink* link; - hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID*)&link); - - if (SUCCEEDED(hres)) { - IPersistFile* persistFile; - - link->SetPath(targetPath); - link->SetArguments(args); - - hres = link->QueryInterface(IID_IPersistFile, (LPVOID*)&persistFile); - if (SUCCEEDED(hres)) { - WCHAR wstr[MAX_PATH]; - - MultiByteToWideChar(CP_ACP, 0, linkPath, -1, wstr, MAX_PATH); - - hres = persistFile->Save(wstr, TRUE); - persistFile->Release(); - } - link->Release(); - } - return hres; -} - -#endif - QString getDesktopDir() { return QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);