@@ -37,7 +37,13 @@ fn get_junit_runner_path() -> Result<PathBuf, JavaError> {
3737 let jar_dir = tmc_dir ( ) ?;
3838
3939 let junit_path = jar_dir. join ( "tmc-junit-runner.jar" ) ;
40- if !junit_path. exists ( ) {
40+ if let Ok ( bytes) = file_util:: read_file ( & junit_path) {
41+ if TMC_CHECKSTYLE_RUNNER_BYTES != bytes. as_slice ( ) {
42+ log:: debug!( "updating tmc junit runner jar" ) ;
43+ file_util:: write_to_file ( & mut TMC_JUNIT_RUNNER_BYTES , & junit_path) ?;
44+ }
45+ } else {
46+ log:: debug!( "failed to read tmc junit runner jar, writing" ) ;
4147 file_util:: write_to_file ( & mut TMC_JUNIT_RUNNER_BYTES , & junit_path) ?;
4248 }
4349 Ok ( junit_path)
@@ -48,7 +54,13 @@ fn get_checkstyle_runner_path() -> Result<PathBuf, JavaError> {
4854 let jar_dir = tmc_dir ( ) ?;
4955
5056 let checkstyle_path = jar_dir. join ( "tmc-checkstyle-runner.jar" ) ;
51- if !checkstyle_path. exists ( ) {
57+ if let Ok ( bytes) = file_util:: read_file ( & checkstyle_path) {
58+ if TMC_CHECKSTYLE_RUNNER_BYTES != bytes. as_slice ( ) {
59+ log:: debug!( "updating checkstyle runner jar" ) ;
60+ file_util:: write_to_file ( & mut TMC_CHECKSTYLE_RUNNER_BYTES , & checkstyle_path) ?;
61+ }
62+ } else {
63+ log:: debug!( "failed to read checkstyle runner jar, writing" ) ;
5264 file_util:: write_to_file ( & mut TMC_CHECKSTYLE_RUNNER_BYTES , & checkstyle_path) ?;
5365 }
5466 Ok ( checkstyle_path)
@@ -60,7 +72,14 @@ fn initialize_jassets() -> Result<PathBuf, JavaError> {
6072 let jassets_dir = jar_dir. join ( "jassets" ) ;
6173
6274 let j4rs_path = jassets_dir. join ( "j4rs.jar" ) ;
63- if !j4rs_path. exists ( ) {
75+
76+ if let Ok ( bytes) = file_util:: read_file ( & j4rs_path) {
77+ if J4RS_BYTES != bytes. as_slice ( ) {
78+ log:: debug!( "updating j4rs jar" ) ;
79+ file_util:: write_to_file ( & mut J4RS_BYTES , & j4rs_path) ?;
80+ }
81+ } else {
82+ log:: debug!( "failed to read j4rs jar, writing" ) ;
6483 file_util:: write_to_file ( & mut J4RS_BYTES , & j4rs_path) ?;
6584 }
6685 Ok ( j4rs_path)
0 commit comments