Skip to content

Commit b96c210

Browse files
committed
add program icon and drag-to-run feature for Windows
1 parent 277277d commit b96c210

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

resources.rc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,6 @@ BEGIN
3131
BEGIN
3232
VALUE "Translation", 0x409, 1200
3333
END
34-
END
34+
END
35+
36+
1 ICON "resources/app.ico"

resources/app.ico

264 KB
Binary file not shown.

src/main.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ mod build_time {
2121
#[command(author, version, about, long_about = None)]
2222
struct Args {
2323
/// Input audio file path (supports WAV, MP3, FLAC, OGG, AAC, etc.)
24-
#[arg(short, long)]
25-
input: String,
24+
#[arg(short, long, value_name = "FILE")]
25+
input: Option<String>,
26+
27+
/// Input audio file (position argument, for drag-and-drop support)
28+
#[arg(value_name = "INPUT_FILE")]
29+
input_file: Option<String>,
2630

2731
/// Output spectrogram file path
2832
#[arg(short, long)]
@@ -620,15 +624,18 @@ fn main() {
620624
println!("─────────────────────────────────────────────────");
621625

622626
let args = Args::parse();
627+
628+
let input_path = args.input.or(args.input_file)
629+
.expect("No input file specified. Use -i option or drag-and-drop a file.");
623630

624631
let output_path = args.output.unwrap_or_else(|| {
625-
let input_path = std::path::Path::new(&args.input);
632+
let input_path = std::path::Path::new(&input_path);
626633
let stem = input_path.file_stem().unwrap_or_default();
627634
format!("{}.png", stem.to_string_lossy())
628635
});
629636

630637
let (samples, sample_rate) =
631-
read_audio_samples(&args.input).expect("Failed to read audio file");
638+
read_audio_samples(&input_path).expect("Failed to read audio file");
632639

633640
let fft_size = args.fft_size;
634641
let hop_size = args.hop_size.unwrap_or(fft_size / 2);

0 commit comments

Comments
 (0)