Fixed bugs in update_file() method and create_hdf5_file_from_filesystem_path()

This commit is contained in:
2024-10-03 09:32:25 +02:00
parent 098a79531c
commit 89e9dd9ab1
2 changed files with 7 additions and 6 deletions

View File

@ -138,10 +138,10 @@ def create_hdf5_file_from_filesystem_path(path_to_input_directory: str,
select_dir_keywords[i] = keyword.replace('/',os.sep)
if not path_to_filenames_dict:
# On dry_run=True, returns path to files dictionary of the output directory without making a actual copy of the input directory
path_to_output_directory = os.path.join(path_to_input_directory,'..')
path_to_filenames_dict = utils.copy_directory_with_contraints(path_to_input_directory,
path_to_output_directory,
# On dry_run=True, returns path to files dictionary of the output directory without making a actual copy of the input directory.
# Therefore, there wont be a copying conflict by setting up input and output directories the same
path_to_filenames_dict = utils.copy_directory_with_contraints(input_dir_path=path_to_input_directory,
output_dir_path=path_to_input_directory,
dry_run=True)
# Set input_directory as copied input directory
root_dir = path_to_input_directory

View File

@ -359,11 +359,12 @@ class HDF5DataOpsManager():
def update_file(self, path_to_append_dir):
# Split the reference file path and the append directory path into directories and filenames
ref_tail, ref_head = os.path.split(self.file_path)
ref_head_filename, head_ext = os.path.splitext(ref_head)
tail, head = os.path.split(path_to_append_dir)
head_filename, head_ext = os.path.splitext(head)
# Ensure the append directory is in the same directory as the reference file and has the same name (without extension)
if not (ref_tail == tail and ref_head == head_filename):
if not (ref_tail == tail and ref_head_filename == head):
raise ValueError("The append directory must be in the same directory as the reference HDF5 file and have the same name without the extension.")
# Close the file if it's already open