- Document purpose of global variable
- Add TODO for moving base filename of input CUE/LOG/WAV to global variable as we pass it around very much.
- Properly document parameters of set_working_directory_or_die.
- Properly document parameters of ask_to_delete_existing_output_and_temp_dirs_or_die. I've checked all uses of the function for proper syntax
- main(): Rename "output_dir" to "output_dir_relative" because it is relative
Improve set_working_directory usage:
- set_working_directory() works with zero parameters as well now, then the dir is set to  $WORKING_DIR_ABSOLUTE.
- All instances of "set_working_directory $WORKING_DIR_ABSOLUTE" have been changed accordingly.
Move code which is only needed inside an "if" into it.
Rename "WORKING_DIR_ABSOLUTE" to "INPUT_DIR_ABSOLUTE". Add TODO for also adding an OUTPUT_DIR_ABSOLUTE.
Pass the path to shntool instead of using set_working_directory. Downside is that the full path will be logged but this code is for unit tests only.
Remove useless local variable in main()
Begin cleanup of variable usage of main():
- Initialize global INPUT_CUE_LOG_WAV_BASENAME
- Initialize global OUTPUT_DIR_ABSOLUTE
- Add TODOs for making proper use of the globals, currently they are used as if they were local
- Don't harcode the variable which is used for computing the output dir in "Your FLACs are in directory" echo, instead use the variable which holds the output dir actually
- Make check_whether_input_is_accurately_ripped_or_die() use global variables instead of a parameter
Introduce global variables to hold path of CUE/WAV/LOG and add TODOs to use them. This will avoid code duplication and typos in pathnames.
- Make check_whether_input_is_accurately_ripped_or_die() use INPUT_LOG_ABSOLUTE
Make check_shntool_wav_problem_diagnosis_or_die() use global variables instead of taking parameters. Do not include the file path in the regexp: This could lead to problems if regexp special characters are used in the filename.
- Make get_eac_crc_or_die a dumb helper function: Do not use globals, instead take the full path of EAC LOG. This does not match the convetion of using globals as much as possible but makes the function name easier to understand when reading calls to it.
- Make test_whether_the_two_eac_crcs_match use globals instead of parameters
- Check whether an unit test was enabled at the very end of the script and abort with "Unit test failure". The program should abort if any errors happen so reaching the end of it with unit tests enabled shows that they failed. Also document this.
test_eac_crc_or_die():
- Use globals instead of paramaters
- Obtain expected CRC value AFTER damaging the input WAV. This will make the unit test also catch error conditions where for some reason the expected CRC is not read from the LOG but set to the actual CRC of the WAV image.
Fix regexp for parsing "shntool len" output. Unfortunately its not possible to make the regexp any more procise because input filenames can contain lots of regexp special characters and I don't know how to escape ALL.
But this shouldn't cause much harm because we expect "---" / "--" / "-----" as output of the regexp and those are not every common in audio filenames so it is highly unlikely that random mismatching causes the function to succeed accidentially.
Fix syntax breakage of unit test code
Fix breakage of unit test failure detection. Document why this happened to make sure that all associative array usage stays safe.
- split_wav_image_to_singletracks_or_die(): Use globals instead of parameters
- set_working_directory_or_die_ where we actually need it.
Rename local variable which is ambigious with global variable name
Proof-read "shntool split" parameters again:
- Remove unused parameters from the syntax list.
- Add TODO to make someone else review them