MCPcopy Create free account
hub / github.com/Predelnik/DSpellCheck / download_dictionary

Method download_dictionary

src/network/GithubFileListProvider.cpp:179–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177}
178
179void GitHubFileListProvider::download_dictionary(const std::wstring &aff_filepath, const std::wstring &target_path,
180 std::shared_ptr<ProgressData> progress_data) {
181 m_download_file_task.do_deferred(
182 [=, settings_data = m_settings.data](Concurrency::cancellation_token token) -> DownloadResult {
183 std::vector<std::wstring> downloaded_filenames;
184 bool cancelled = false;
185 try {
186 auto ret = download_dictionary_impl(token, aff_filepath, target_path, progress_data, downloaded_filenames, settings_data, cancelled);
187 if (ret) {
188 for (auto &file_name : downloaded_filenames)
189 WinApi::delete_file(file_name.c_str());
190 }
191 return {ret, cancelled};
192 } catch (const std::exception &err) {
193 for (auto &file_name : downloaded_filenames)
194 WinApi::delete_file(file_name.c_str());
195 return {err.what(), false};
196 }
197 },
198 [this](DownloadResult result) { file_downloaded(result.mb_error_description, result.was_cancelled); });
199}
200
201void GitHubFileListProvider::cancel_download() { m_download_file_task.cancel(); }

Callers 1

download_github_fileMethod · 0.80

Calls 4

delete_fileFunction · 0.85
do_deferredMethod · 0.80
c_strMethod · 0.80
whatMethod · 0.45

Tested by

no test coverage detected