Skip to content

Commit

Permalink
fix launch default with no header
Browse files Browse the repository at this point in the history
  • Loading branch information
BrettMayson committed Oct 15, 2023
1 parent 0f8254f commit 846265b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
12 changes: 10 additions & 2 deletions bin/src/commands/launch.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
use std::path::{Path, PathBuf};
use std::{
borrow::Cow,
path::{Path, PathBuf},
};

use clap::{ArgMatches, Command};
use hemtt_project::ProjectConfig;
use hemtt_project::{hemtt::LaunchOptions, ProjectConfig};
use steamlocate::SteamDir;

use crate::{error::Error, utils::create_link};
Expand Down Expand Up @@ -51,6 +54,11 @@ pub fn execute(matches: &ArgMatches) -> Result<(), Error> {
let launch = config
.hemtt()
.launch(&launch_config)
.or(if launch_config == "default" {
Some(Cow::Owned(LaunchOptions::default()))
} else {
None
})
.ok_or(Error::LaunchConfigNotFound(launch_config.to_string()))?;

let Some(arma3dir) =
Expand Down
6 changes: 3 additions & 3 deletions libs/project/src/hemtt.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::collections::HashMap;
use std::{borrow::Cow, collections::HashMap};

use hemtt_common::arma::dlc::DLC;
use serde::{Deserialize, Serialize};
Expand All @@ -25,8 +25,8 @@ impl Features {
}

#[must_use]
pub fn launch(&self, key: &str) -> Option<&LaunchOptions> {
self.launch.get(key)
pub fn launch(&self, key: &str) -> Option<Cow<LaunchOptions>> {
self.launch.get(key).map(Cow::Borrowed)
}

#[must_use]
Expand Down
2 changes: 1 addition & 1 deletion libs/project/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mod addon;
mod asc;
mod error;
mod files;
mod hemtt;
pub mod hemtt;
mod lint;
mod signing;
mod version;
Expand Down

0 comments on commit 846265b

Please sign in to comment.