Implemented option -mkdir
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user