MCPcopy Create free account
hub / github.com/AstroTechies/unrealmodding / process_modfiles

Function process_modfiles

unreal_mod_manager/src/mod_processing/mod.rs:20–64  ·  view source on GitHub ↗

TODO this should at somepoint be changed to `-> Result , ModLoaderError>` to properly convey that some things might critically fail.

(
    mod_files: &Vec<FileToProcess>,
    data: &Arc<Mutex<ModLoaderAppData>>,
    set_enabled: bool,
)

Source from the content-addressed store, hash-verified

18// TODO this should at somepoint be changed to `-> Result<Vec<ModLoaderWarning>, ModLoaderError>`
19// to properly convey that some things might critically fail.
20pub(crate) fn process_modfiles(
21 mod_files: &Vec<FileToProcess>,
22 data: &Arc<Mutex<ModLoaderAppData>>,
23 set_enabled: bool,
24) -> Vec<ModLoaderWarning> {
25 debug!("Processing mod files: {:?}", mod_files);
26
27 let mut warnings = Vec::new();
28
29 // read metadata from pak files and collect for each mod_id
30 let (mods_read, read_warnings) = read_pak_files(mod_files);
31 warnings.extend(read_warnings);
32
33 let mut data_guard = data.lock();
34 let filter: Vec<String> = mods_read.keys().cloned().collect();
35
36 // turn metadata into proper data structures
37 insert_mods_from_readdata(&mods_read, &mut data_guard, set_enabled);
38
39 // pick version
40 auto_pick_versions(&mut data_guard);
41
42 // set top level data
43 set_mod_data_from_version(&mut data_guard, &filter);
44
45 // fetch index files
46
47 // gather index files from all the mods
48 let index_files_info = gather_index_files(&data_guard, &filter);
49
50 // drop guard to allow UI to render while index files are being downloaded
51 drop(data_guard);
52
53 // actually download index files
54 let (index_files, index_file_warnings) = download_index_files(index_files_info);
55 warnings.extend(index_file_warnings);
56
57 let mut data_guard = data.lock();
58
59 // insert index file data into the mod data
60 let insert_warnings = insert_index_file_data(&index_files, &mut data_guard);
61 warnings.extend(insert_warnings);
62
63 warnings
64}

Callers 1

background_workFunction · 0.85

Calls 9

read_pak_filesFunction · 0.85
auto_pick_versionsFunction · 0.85
gather_index_filesFunction · 0.85
download_index_filesFunction · 0.85
insert_index_file_dataFunction · 0.85
extendMethod · 0.80
keysMethod · 0.80

Tested by

no test coverage detected