diff --git a/libisofs/ecma119.c b/libisofs/ecma119.c index 53e4e7b..a1ac681 100755 --- a/libisofs/ecma119.c +++ b/libisofs/ecma119.c @@ -319,6 +319,8 @@ ecma119_target_new(struct iso_volset *volset, if (t->joliet) joliet_calc_dir_pos(t, t->joliet_root); calc_file_pos(t, t->root); + if (t->joliet) + joliet_update_file_pos (t, t->joliet_root); if (t->rockridge) { susp_finalize(t, t->root); diff --git a/libisofs/joliet.c b/libisofs/joliet.c index d1ddad9..d64675b 100644 --- a/libisofs/joliet.c +++ b/libisofs/joliet.c @@ -142,6 +142,30 @@ joliet_calc_dir_pos(struct ecma119_write_target *t, t->curfile = 0; } +void +joliet_update_file_pos(struct ecma119_write_target *t, + struct joliet_tree_node *dir) +{ + size_t i; + + assert(dir && ISO_ISDIR(dir->iso_self)); + for (i = 0; i < dir->nchildren; i++) { + struct joliet_tree_node *ch; + ch = dir->children[i]; + + if (!ISO_ISDIR (ch->iso_self)) { + struct iso_tree_node *iso = ch->iso_self; + ch->block = iso->block; + } + else + joliet_update_file_pos(t, ch); + } + + /* reset curfile when we're finished */ + if (!dir->parent) + t->curfile = 0; +} + struct joliet_tree_node* joliet_tree_create(struct ecma119_write_target *t, struct iso_tree_node *iso_root) diff --git a/libisofs/joliet.h b/libisofs/joliet.h index 1975293..e5b7582 100644 --- a/libisofs/joliet.h +++ b/libisofs/joliet.h @@ -52,6 +52,13 @@ joliet_calc_dir_size(struct ecma119_write_target *t, struct joliet_tree_node*); void joliet_calc_dir_pos(struct ecma119_write_target *t, struct joliet_tree_node*); +/** + * Update the position of each file in the joliet hierarchy (to be called + * AFTER the file positions in the iso tree have been set). + */ +void +joliet_update_file_pos(struct ecma119_write_target *t, struct joliet_tree_node*); + /** * Calculate the size of the joliet path table and fill in the list of * directories.