Implemented option -mkdir
This commit is contained in:
parent
99cb813d42
commit
7511f4e4bc
@ -297,7 +297,7 @@ Alter the date entries of a file in the ISO image. type is
|
||||
one of "a", "m", "b" for access time, modification time,
|
||||
both times.
|
||||
.TP
|
||||
> \fB\-mkdir\fR iso_rr_path [...]
|
||||
\fB\-mkdir\fR iso_rr_path [...]
|
||||
Create empty directories if they do not exist yet.
|
||||
Existence as directory generates a WARNING event, existence as
|
||||
other file cause a SORRY event.
|
||||
|
@ -4100,17 +4100,21 @@ int Xorriso_option_mark(struct XorrisO *xorriso, char *mark, int flag)
|
||||
int Xorriso_option_mkdiri(struct XorrisO *xorriso, int argc, char **argv,
|
||||
int *idx, int flag)
|
||||
{
|
||||
int i, end_idx;
|
||||
int i, end_idx, ret, was_failure= 0;
|
||||
|
||||
end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 0);
|
||||
|
||||
fprintf(stderr, ">>> LIBISOFS : -mkdiri ");
|
||||
for(i= *idx; i<end_idx; i++)
|
||||
fprintf(stderr, "%s ", argv[i]);
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
for(i= *idx; i<end_idx; i++) {
|
||||
ret= Xorriso_mkdir(xorriso, argv[i], 0);
|
||||
if(ret<0)
|
||||
{ret= 0; goto ex;}
|
||||
if(ret==0)
|
||||
was_failure= 1;
|
||||
}
|
||||
ret= 1;
|
||||
ex:;
|
||||
(*idx)= end_idx;
|
||||
return(1);
|
||||
return(ret>0 && !was_failure);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1 +1 @@
|
||||
#define Xorriso_timestamP "2007.10.28.125501"
|
||||
#define Xorriso_timestamP "2007.10.28.165516"
|
||||
|
@ -1394,8 +1394,7 @@ ex:;
|
||||
}
|
||||
|
||||
|
||||
int Xorriso_rename(struct XorrisO *xorriso,
|
||||
char origin[], char dest[], int flag)
|
||||
int Xorriso_rename(struct XorrisO *xorriso, char *origin, char *dest, int flag)
|
||||
{
|
||||
int ret, ol, dest_ret;
|
||||
char sfe[4*SfileadrL], eff_dest[SfileadrL], dir_adr[SfileadrL], *cpt;
|
||||
@ -1508,3 +1507,37 @@ int Xorriso_rename(struct XorrisO *xorriso,
|
||||
}
|
||||
|
||||
|
||||
/* @param flag bit0= do not produce info message on success
|
||||
@return 1=success,
|
||||
0=was already directory, -1=was other type, -2=other error
|
||||
*/
|
||||
int Xorriso_mkdir(struct XorrisO *xorriso, char *path, int flag)
|
||||
{
|
||||
int ret;
|
||||
char eff_path[SfileadrL], sfe[4*SfileadrL];
|
||||
|
||||
ret= Xorriso_normalize_img_path(xorriso, path, eff_path, 1);
|
||||
if(ret<0)
|
||||
return(-2);
|
||||
if(ret>0) {
|
||||
sprintf(xorriso->info_text,"-mkdir: Address already existing %s",
|
||||
Text_shellsafe(eff_path, sfe, 0));
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0,
|
||||
(ret==2 ? "WARNING" : "SORRY"), 0);
|
||||
return(-1+(ret==2));
|
||||
}
|
||||
ret= Xorriso_normalize_img_path(xorriso, path, eff_path, 2);
|
||||
if(ret<0)
|
||||
return(-2);
|
||||
ret= Xorriso_graft_in(xorriso, NULL, eff_path, 1);
|
||||
if(ret<=0)
|
||||
return(-2);
|
||||
if(!(flag&1)) {
|
||||
sprintf(xorriso->info_text, "Created directory in ISO image: %s\n",
|
||||
Text_shellsafe(eff_path,sfe,0));
|
||||
Xorriso_info(xorriso, 0);
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -69,8 +69,12 @@ int Xorriso_ls(struct XorrisO *xorriso, int flag);
|
||||
int Xorriso_normalize_img_path(struct XorrisO *xorriso, char *img_path,
|
||||
char eff_path[], int flag);
|
||||
|
||||
int Xorriso_rename(struct XorrisO *xorriso,
|
||||
char origin[], char dest[], int flag);
|
||||
int Xorriso_rename(struct XorrisO *xorriso, char *origin, char *dest,int flag);
|
||||
|
||||
/* @param flag bit0= do not produce info message on success
|
||||
@return 1=success, 0=was already directory, -1=was other type, -2=bad path
|
||||
*/
|
||||
int Xorriso_mkdir(struct XorrisO *xorriso, char *img_path, int flag);
|
||||
|
||||
#endif /* Xorrisoburn_includeD */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user