2
2
3
3
#include " helpers/find-gmod-directory.hpp"
4
4
#include " helpers/find-steam-directory.hpp"
5
+ #include " logging/log.hpp"
5
6
#include " uninstall-gelly.hpp"
6
7
7
8
#include < fstream>
@@ -47,8 +48,10 @@ void ExtractReleaseToDir(const std::filesystem::path &dir,
47
48
throw std::runtime_error (" Failed to open zip archive." );
48
49
}
49
50
51
+ Log::Info (" Extracting Gelly release to {}" , dir.string ());
50
52
try {
51
53
zip_int64_t numFiles = zip_get_num_files (archive);
54
+ Log::Info (" Extracting {} files from zip archive." , numFiles);
52
55
for (zip_int64_t i = 0 ; i < numFiles; i++) {
53
56
auto *file = zip_fopen_index (archive, i, 0 );
54
57
if (!file) {
@@ -94,22 +97,27 @@ void ExtractReleaseToDir(const std::filesystem::path &dir,
94
97
zip_fclose (file);
95
98
}
96
99
} catch (...) {
100
+ Log::Error (" Failed to extract Gelly release." );
97
101
zip_discard (archive);
98
102
throw ;
99
103
}
100
104
101
105
zip_discard (archive);
106
+ Log::Info (" Extracted Gelly release to {}" , dir.string ());
102
107
}
103
108
} // namespace
104
109
105
110
void InstallGelly (const LatestGellyInfo &info,
106
111
const std::shared_ptr<Curl> &curl,
107
112
std::optional<GellyInstallation> priorInstallation) {
113
+ Log::Info (" Installing Gelly version {}" , info.version );
108
114
if (priorInstallation.has_value ()) {
109
115
UninstallGelly (*priorInstallation);
116
+ Log::Info (" Uninstalled prior Gelly installation." );
110
117
}
111
118
112
119
const auto release = DownloadRelease (info.downloadUrl , curl);
120
+ Log::Info (" Downloading Gelly release." );
113
121
if (release.IsEmpty ()) {
114
122
throw std::runtime_error (" Failed to download Gelly release." );
115
123
}
@@ -120,6 +128,7 @@ void InstallGelly(const LatestGellyInfo &info,
120
128
throw std::runtime_error (" Failed to find Garry's Mod directory." );
121
129
}
122
130
131
+ Log::Info (" Extracting Gelly release to Garry's Mod directory." );
123
132
ExtractReleaseToDir (*gmodDir, release);
124
133
}
125
134
0 commit comments