Skip to content

Commit f28769d

Browse files
committed
Merge branch 'main' of https://github.com/geode-sdk/cli into main
2 parents 4fb789a + d21a3d6 commit f28769d

File tree

4 files changed

+28
-11
lines changed

4 files changed

+28
-11
lines changed

src/file.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ pub fn read_dir_recursive(src: &PathBuf) -> Result<Vec<PathBuf>, io::Error> {
88
for item in fs::read_dir(src)? {
99
let path = item?.path();
1010
if path.is_dir() {
11-
res.extend(read_dir_recursive(src)?);
11+
res.extend(read_dir_recursive(&path)?);
12+
res.push(path);
1213
} else {
1314
res.push(path);
1415
}

src/index.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::config::Config;
2-
use crate::file::copy_dir_recursive;
2+
use crate::file::{copy_dir_recursive, read_dir_recursive};
33
use crate::util::logging::ask_value;
44
use crate::util::mod_file::{parse_mod_info, try_parse_mod_info};
55
use crate::{done, fatal, info, warn, NiceUnwrap};
@@ -180,11 +180,12 @@ pub fn index_mods_dir(config: &Config) -> PathBuf {
180180
}
181181

182182
pub fn get_entry(config: &Config, id: &String, version: &VersionReq) -> Option<Entry> {
183-
for dir in index_mods_dir(config)
184-
.read_dir()
185-
.nice_unwrap("Unable to read index")
186-
{
187-
let path = dir.unwrap().path();
183+
let dir = index_mods_dir(config).join(id);
184+
185+
for path in {
186+
read_dir_recursive(&dir)
187+
.nice_unwrap("Unable to read index")
188+
} {
188189
let Ok(mod_info) = try_parse_mod_info(&path) else {
189190
continue;
190191
};
@@ -198,6 +199,7 @@ pub fn get_entry(config: &Config, id: &String, version: &VersionReq) -> Option<E
198199
);
199200
}
200201
}
202+
201203
None
202204
}
203205

src/project.rs

+15-4
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,25 @@ impl Found {
150150
fn find_dependency(
151151
dep: &Dependency,
152152
dir: &PathBuf,
153-
search_recursive: bool
153+
search_recursive: bool,
154+
mods_v2: bool
154155
) -> Result<Found, std::io::Error> {
155156
// for checking if the id was possibly misspelled, it must be at most 3
156157
// steps away from the searched one
157158
let mut closest_score = 4usize;
158159
let mut found = Found::None;
160+
let mut dir = dir.clone();
161+
162+
// this doesnt work with the fuzzy search misspelling check or whatever
163+
// someone else can fix it i dont care kthx
164+
if mods_v2 {
165+
dir = dir.join(&dep.id);
166+
if !dir.exists() {
167+
return Ok(Found::None);
168+
}
169+
}
159170
for dir in if search_recursive {
160-
read_dir_recursive(dir)?
171+
read_dir_recursive(&dir)?
161172
} else {
162173
dir.read_dir()?.map(|d| d.unwrap().path()).collect()
163174
} {
@@ -273,12 +284,12 @@ pub fn check_dependencies(
273284

274285
// check index
275286
let found_in_index = find_dependency(
276-
&dep, &index_mods_dir(config), false
287+
&dep, &index_mods_dir(config), true, true
277288
).nice_unwrap("Unable to read index");
278289

279290
// check installed mods
280291
let found_in_installed = find_dependency(
281-
&dep, &config.get_current_profile().mods_dir(), true
292+
&dep, &config.get_current_profile().mods_dir(), true, false
282293
).nice_unwrap("Unable to read installed mods");
283294

284295
// if not found in either hjfod code

src/project_build.rs

+3
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ pub fn build_project(
8080
if cfg!(target_os = "windows") && !extra_conf_args.contains(&"-G".to_owned()) {
8181
conf_args.extend(["-G", "Ninja"].map(String::from));
8282
}
83+
conf_args.push("-DCMAKE_EXPORT_COMPILE_COMMANDS=1".into());
84+
// TODO: cli cant install to a mobile device, yet
85+
conf_args.push("-DGEODE_DONT_INSTALL_MODS=1".into());
8386
}
8487
}
8588
_ => unreachable!("invalid platform"),

0 commit comments

Comments
 (0)