From c0fc7868752a8b57084f1269e5c1e8e54992f709 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sat, 16 Feb 2008 20:26:21 +0000 Subject: [PATCH] Transfering properties from disk to implicit directories in image path --- xorriso/xorriso_private.h | 7 ++++++ xorriso/xorriso_timestamp.h | 2 +- xorriso/xorrisoburn.c | 50 +++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) diff --git a/xorriso/xorriso_private.h b/xorriso/xorriso_private.h index caecb46a..ab0b893e 100644 --- a/xorriso/xorriso_private.h +++ b/xorriso/xorriso_private.h @@ -332,6 +332,13 @@ int Sfile_scale(double value, char *result, int siz, double thresh, int flag); int Sfile_destroy_argv(int *argc, char ***argv, int flag); +/* + bit0= do not ignore trailing slash + bit1= do not ignore empty components (other than the empty root name) +*/ +int Sfile_count_components(char *path, int flag); + + char *Text_shellsafe(char *in_text, char *out_text, int flag); int Sort_argv(int argc, char **argv, int flag); diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 950d403c..d2ec9c2a 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2008.02.15.212030" +#define Xorriso_timestamP "2008.02.16.202533" diff --git a/xorriso/xorrisoburn.c b/xorriso/xorrisoburn.c index c38c80c2..b6645a97 100644 --- a/xorriso/xorrisoburn.c +++ b/xorriso/xorrisoburn.c @@ -1547,6 +1547,53 @@ ex: } +int Xorriso_copy_implict_properties(struct XorrisO *xorriso, IsoDir *dir, + char *full_img_path, char *img_path, char *full_disk_path, int flag) +{ + int ret, nfic, nic, nfdc, d, i; + char nfi[SfileadrL], ni[SfileadrL], nfd[SfileadrL], *cpt; + char sfe[5*SfileadrL]; + struct stat stbuf; + + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, full_img_path, nfi, + 1|2); + if(ret<=0) + return(ret); + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, img_path, ni, 1|2); + if(ret<=0) + return(ret); + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, full_disk_path, nfd, + 1|2|4); + if(ret<=0) + return(ret); + nfic= Sfile_count_components(nfi, 0); + nic= Sfile_count_components(ni, 0); + nfdc= Sfile_count_components(nfd, 0); + d= nfic-nic; + if(d<0) + return(-1); + if(d>nfdc) + return(0); + for(i= 0; iinfo_text, + "Copied properties for %s", Text_shellsafe(ni, sfe, 0)); + sprintf(xorriso->info_text+strlen(xorriso->info_text), + " from %s", Text_shellsafe(nfd, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + return(1); +} + + /** @param flag bit0= mkdir: graft in as empty directory, not as copy from disk @return <=0 = error , 1 = added simple node , 2 = added directory */ int Xorriso_graft_in(struct XorrisO *xorriso, char *disk_path, char *img_path, @@ -1701,6 +1748,9 @@ handle_path_node:; /* >>> copy properties from correspondent directory in disk_path if there is any */; + if(!done) + Xorriso_copy_implict_properties(xorriso, dir, img_path, path, disk_path, + 0); } if(done) {