Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 22 additions & 18 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,18 @@ fn main() -> Result<()> {
.find(|arg| arg.starts_with("--profile="))
.map(|arg| arg.split_at(10).1.to_string())
.unwrap_or_else(|| "release".into());
std::env::args()
let profile = std::env::args()
.skip(2)
.find(|arg| arg.starts_with("--target="))
.map(|arg| format!("{}/{}", arg.split_at(9).1, profile))
.unwrap_or_else(|| profile)
.unwrap_or_else(|| profile);

// TODO: in-depth metadata parsing
if profile == "dev" {
"debug".to_string()
} else {
profile
}
};
let link_deps;
let mut link_exclude_list = Vec::with_capacity(0);
Expand All @@ -82,17 +89,11 @@ fn main() -> Result<()> {
}
_ => assets = Vec::with_capacity(0),
}
match t.get("icon") {
Some(Value::String(s)) => {
icon_path = s;
}
_ => {},
if let Some(Value::String(s)) = t.get("icon") {
icon_path = s;
}
match t.get("desktop_entry") {
Some(Value::String(s)) => {
desktop_entry_path = s;
}
_ => {},
if let Some(Value::String(s)) = t.get("desktop_entry") {
desktop_entry_path = s;
}
match t.get("auto_link") {
Some(Value::Boolean(v)) => link_deps = v.to_owned(),
Expand Down Expand Up @@ -201,10 +202,10 @@ fn main() -> Result<()> {
let path = &i?.path();

// Skip if it matches the exclude list.
if let Some(file_name) = path.file_name().and_then(|p| p.to_str()) {
if link_exclude_list.iter().any(|p| p.matches(file_name)) {
continue;
}
if let Some(file_name) = path.file_name().and_then(|p| p.to_str())
&& link_exclude_list.iter().any(|p| p.matches(file_name))
{
continue;
}

let link = std::fs::read_link(path)
Expand Down Expand Up @@ -279,8 +280,11 @@ fn main() -> Result<()> {
)
})?;
} else {
std::fs::copy(desktop_entry_path, appdirpath.join("cargo-appimage.desktop"))
.context(format!("Cannot find {desktop_entry_path}"))?;
std::fs::copy(
desktop_entry_path,
appdirpath.join("cargo-appimage.desktop"),
)
.context(format!("Cannot find {desktop_entry_path}"))?;
}

// Copy assets
Expand Down
Loading