Skip to content

Commit 80aeb7c

Browse files
committed
Place bootimage-*.bin in default target directory for runner
This is the same behavior as `bootimage run`.
1 parent 03528dd commit 80aeb7c

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

src/subcommand/runner.rs

+2-20
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
use crate::{args::RunnerArgs, builder::Builder, config, ErrorString};
2-
use std::{fs, process};
2+
use std::process;
33

44
pub(crate) fn runner(args: RunnerArgs) -> Result<i32, ErrorString> {
55
let builder = Builder::new(None)?;
66
let config = config::read_config(builder.kernel_manifest_path().to_owned())?;
77

88
let bootimage_bin = {
9-
let kernel_target_dir = &builder.kernel_metadata().target_directory;
10-
let bootimage_target_dir = kernel_target_dir.join("bootimage").join("runner");
11-
129
let parent = args
1310
.executable
1411
.parent()
@@ -19,22 +16,7 @@ pub(crate) fn runner(args: RunnerArgs) -> Result<i32, ErrorString> {
1916
.ok_or("kernel executable has no file stem")?
2017
.to_str()
2118
.ok_or("kernel executable file stem is not valid UTF-8")?;
22-
let sub_path = parent.strip_prefix(kernel_target_dir).map_err(|err| {
23-
format!(
24-
"kernel executable does not live in kernel target directory: {}",
25-
err
26-
)
27-
})?;
28-
29-
let out_dir = bootimage_target_dir.join(sub_path);
30-
fs::create_dir_all(&out_dir).map_err(|err| {
31-
format!(
32-
"failed to create output directory {}: {}",
33-
out_dir.display(),
34-
err
35-
)
36-
})?;
37-
out_dir.join(format!("bootimage-{}.bin", file_stem))
19+
parent.join(format!("bootimage-{}.bin", file_stem))
3820
};
3921

4022
builder.create_bootimage(&args.executable, &bootimage_bin, false)?;

0 commit comments

Comments
 (0)