Skip to content

Commit

Permalink
run cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
matcool committed Nov 16, 2024
1 parent dd30814 commit 7c05860
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 31 deletions.
12 changes: 10 additions & 2 deletions src/index_admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,16 @@ impl Display for PendingModVersion {
writeln!(f, " - API: {}", self.api)?;
writeln!(f, " - GD:")?;
writeln!(f, " - Win: {}", self.gd.win.as_deref().unwrap_or("None"))?;
writeln!(f, " - Mac Intel: {}", self.gd.mac_intel.as_deref().unwrap_or("None"))?;
writeln!(f, " - Mac ARM: {}", self.gd.mac_arm.as_deref().unwrap_or("None"))?;
writeln!(
f,
" - Mac Intel: {}",
self.gd.mac_intel.as_deref().unwrap_or("None")
)?;
writeln!(
f,
" - Mac ARM: {}",
self.gd.mac_arm.as_deref().unwrap_or("None")
)?;
writeln!(
f,
" - Android 32: {}",
Expand Down
21 changes: 10 additions & 11 deletions src/project_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,22 @@ pub fn build_project(
fatal!("Could not find CMakeLists.txt. Please run this within a Geode project!");
}

let platform = platform
.unwrap_or_else(|| PlatformName::current().nice_unwrap("Unknown platform, please specify one with --platform"));

let platform = platform.unwrap_or_else(|| {
PlatformName::current().nice_unwrap("Unknown platform, please specify one with --platform")
});

// Make architechture exact
let platform = match platform {
PlatformName::Android => {
warn!("Assuming 64-bit Android, use \"-p android32\" to build for 32-bit Android");
PlatformName::Android64
},
// If Mac cross-building ever becomes possible, make sure to upgrade Mac
// to MacArm or MacIntel here (or hard error if there's no reasonable
}
// If Mac cross-building ever becomes possible, make sure to upgrade Mac
// to MacArm or MacIntel here (or hard error if there's no reasonable
// default)
p => p,
};

let cross_compiling = if cfg!(target_os = "windows") {
platform != PlatformName::Windows
} else if cfg!(target_os = "linux") {
Expand Down Expand Up @@ -99,8 +100,7 @@ pub fn build_project(
));
if platform == PlatformName::Android32 {
conf_args.push("-DANDROID_ABI=armeabi-v7a".into());
}
else {
} else {
conf_args.push("-DANDROID_ABI=arm64-v8a".into());
}
// TODO: let the user change this? idk
Expand All @@ -118,8 +118,7 @@ pub fn build_project(
let build_type = config_type.unwrap_or_else(|| {
if platform == PlatformName::Windows {
"RelWithDebInfo".into()
}
else {
} else {
"Debug".into()
}
});
Expand Down
26 changes: 16 additions & 10 deletions src/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,27 @@ fn create_template(template: CreateTemplate) {
} else if template.template.is_empty() {
("geode-sdk/example-mod", "main")
} else {
("geode-sdk/example-mod", match template.template.to_ascii_lowercase().as_str() {
"default" => "main",
"minimal" => "minimal",
"custom layer" => "custom-layer",
_ => {
warn!("Invalid template name, using default template");
"main"
}
})
(
"geode-sdk/example-mod",
match template.template.to_ascii_lowercase().as_str() {
"default" => "main",
"minimal" => "minimal",
"custom layer" => "custom-layer",
_ => {
warn!("Invalid template name, using default template");
"main"
}
},
)
};

// Clone repository
RepoBuilder::new()
.branch(branch)
.clone(format!("https://github.com/{}", used_template).as_str(), &template.project_location)
.clone(
format!("https://github.com/{}", used_template).as_str(),
&template.project_location,
)
.nice_unwrap("Unable to clone repository");

if fs::remove_dir_all(template.project_location.join(".git")).is_err() {
Expand Down
12 changes: 4 additions & 8 deletions src/util/mod_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,17 +237,13 @@ impl PlatformName {
pub fn current() -> Option<PlatformName> {
if cfg!(target_os = "windows") {
Some(PlatformName::Windows)
}
else if cfg!(target_os = "android") {
} else if cfg!(target_os = "android") {
Some(PlatformName::Android64)
}
else if cfg!(target_os = "linux") {
} else if cfg!(target_os = "linux") {
Some(PlatformName::Windows)
}
else if cfg!(target_os = "macos") {
} else if cfg!(target_os = "macos") {
Some(PlatformName::MacOS)
}
else {
} else {
None
}
}
Expand Down

0 comments on commit 7c05860

Please sign in to comment.