Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
stenzek
GitHub Repository: stenzek/duckstation
Path: blob/master/src/installer/installer.h
7197 views
1
// SPDX-FileCopyrightText: 2019-2025 Connor McLaughlin <[email protected]>
2
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
3
4
#pragma once
5
6
#include "updater/win32_progress_callback.h"
7
8
#include "common/windows_headers.h"
9
10
#include "7z.h"
11
#include "7zFile.h"
12
13
#include <string>
14
#include <vector>
15
16
class Error;
17
18
class Installer
19
{
20
public:
21
Installer(Win32ProgressCallback* progress, std::string destination_directory);
22
~Installer();
23
24
static bool CheckForEmptyDirectory(const std::string& directory);
25
static bool LaunchApplication(const std::string& directory, Error* error);
26
27
bool Install();
28
29
bool CreateDesktopShortcut();
30
bool CreateStartMenuShortcut();
31
32
private:
33
bool OpenArchiveStream();
34
void CloseArchiveStream();
35
bool ParseArchive();
36
bool PrepareStagingDirectory();
37
bool StageUpdate();
38
bool CommitUpdate();
39
void CleanupStagingDirectory();
40
bool CreateUninstallerEntry();
41
42
bool RecursiveDeleteDirectory(const char* path, bool remove_dir);
43
bool CreateShellLink(const std::string& link_path, const std::string& target_path);
44
45
struct FileToUpdate
46
{
47
std::string destination_filename;
48
u32 file_index;
49
};
50
51
std::string m_zip_path;
52
std::string m_staging_directory;
53
std::string m_destination_directory;
54
55
std::vector<FileToUpdate> m_update_paths;
56
std::vector<std::string> m_update_directories;
57
58
Win32ProgressCallback* m_progress;
59
CFileInStream m_archive_stream = {};
60
CLookToRead2 m_look_stream = {};
61
CSzArEx m_archive = {};
62
63
bool m_archive_stream_opened = false;
64
bool m_archive_opened = false;
65
};
66
67