Transfering properties from disk to implicit directories in image path
This commit is contained in:
parent
b97ab3f824
commit
cbeaeb7a09
@ -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);
|
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);
|
char *Text_shellsafe(char *in_text, char *out_text, int flag);
|
||||||
|
|
||||||
int Sort_argv(int argc, char **argv, int flag);
|
int Sort_argv(int argc, char **argv, int flag);
|
||||||
|
@ -1 +1 @@
|
|||||||
#define Xorriso_timestamP "2008.02.15.212030"
|
#define Xorriso_timestamP "2008.02.16.202533"
|
||||||
|
@ -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; i<d; i++) {
|
||||||
|
cpt= strrchr(nfd, '/');
|
||||||
|
if(cpt==NULL)
|
||||||
|
return(-1); /* should not happen */
|
||||||
|
*cpt= 0;
|
||||||
|
}
|
||||||
|
if(nfd[0]==0)
|
||||||
|
strcpy(nfd, "/");
|
||||||
|
if(stat(nfd, &stbuf)==-1)
|
||||||
|
return(0);
|
||||||
|
Xorriso_transfer_properties(xorriso, &stbuf, (IsoNode *) dir, 0);
|
||||||
|
sprintf(xorriso->info_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
|
/** @param flag bit0= mkdir: graft in as empty directory, not as copy from disk
|
||||||
@return <=0 = error , 1 = added simple node , 2 = added directory */
|
@return <=0 = error , 1 = added simple node , 2 = added directory */
|
||||||
int Xorriso_graft_in(struct XorrisO *xorriso, char *disk_path, char *img_path,
|
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
|
/* >>> copy properties from correspondent directory in disk_path
|
||||||
if there is any */;
|
if there is any */;
|
||||||
|
if(!done)
|
||||||
|
Xorriso_copy_implict_properties(xorriso, dir, img_path, path, disk_path,
|
||||||
|
0);
|
||||||
|
|
||||||
}
|
}
|
||||||
if(done) {
|
if(done) {
|
||||||
|
Loading…
Reference in New Issue
Block a user