From 8e0bff1992cea960e48afd458935ab0779e034e0 Mon Sep 17 00:00:00 2001
From: ashley <ne0ndrag0n@ne0ndrag0n.com>
Date: Sat, 2 Sep 2023 21:37:27 -0400
Subject: [PATCH] User experience/quality of life improvements

---
 src/reskit/cli/evaluator.rs | 9 ++++++---
 src/reskit/cli/settings.rs  | 4 ++++
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/reskit/cli/evaluator.rs b/src/reskit/cli/evaluator.rs
index 97693e6..2458394 100644
--- a/src/reskit/cli/evaluator.rs
+++ b/src/reskit/cli/evaluator.rs
@@ -20,13 +20,14 @@ pub fn run_command() -> Result<(), Box<dyn Error>> {
                     TileOrder::Sprite => "sprite"
                 }
             ),
-        Tools::Soundtrack { input_files, output_directory, input_format: _, output_format: _, source_file_format: _, artifact_output_directory } => {
+        Tools::Soundtrack { input_files, output_directory, input_format: _, output_format: _, source_file_format: _, source_file_output_directory, artifact_output_directory } => {
             if input_files.is_empty() {
                 return Err( "no input files (see `reskit soundtrack --help` for more info)" )?;
             }
 
             let output_directory = if output_directory.ends_with( "/" ) { output_directory.to_string() } else { format!( "{}/", output_directory ) };
             let artifact_output_directory = if artifact_output_directory.ends_with( "/" ) { artifact_output_directory.to_string() } else { format!( "{}/", artifact_output_directory ) };
+            let source_file_output_directory = if source_file_output_directory.ends_with( "/" ) { source_file_output_directory.to_string() } else { format!( "{}/", source_file_output_directory ) };
 
             let modules: Vec<DmfModule> = input_files.iter().map( | filename | Ok( DmfModule::from_file( &filename )? ) ).collect::<Result<Vec<DmfModule>, Box<dyn Error>>>()?;
 
@@ -58,9 +59,11 @@ pub fn run_command() -> Result<(), Box<dyn Error>> {
             // Output the shared artifacts used by all ESF sequences
             println!( "Writing sequence artifacts..." );
             let shared_artifacts = combined_asset_list.to_bytes()?;
-            println!( "Writing sequence artifact {}", format!( "{}music.asm", artifact_output_directory ) );
-            let mut file = File::create( format!( "{}music.asm", artifact_output_directory ) )?;
+            println!( "Writing sequence artifact {}", format!( "{}music.asm", source_file_output_directory ) );
+            let mut file = File::create( format!( "{}music.asm", source_file_output_directory ) )?;
             file.write_all( &shared_artifacts )?;
+
+            print_good( "all files converted successfully" );
         }
     };
 
diff --git a/src/reskit/cli/settings.rs b/src/reskit/cli/settings.rs
index 49d688d..7b5819d 100644
--- a/src/reskit/cli/settings.rs
+++ b/src/reskit/cli/settings.rs
@@ -84,6 +84,10 @@ pub enum Tools {
         #[arg(long, value_enum, default_value_t=ArtifactListFormat::Asmx)]
         source_file_format: ArtifactListFormat,
 
+        /// Output directory for the source file
+        #[arg(long, default_value_t=String::from("./"))]
+        source_file_output_directory: String,
+
         /// Directory to output artifacts (instruments and samples)
         #[arg(long, default_value_t=String::from( "./" ))]
         artifact_output_directory: String