New command -lns for creating symbolic links
This commit is contained in:
@ -723,6 +723,24 @@ int Xorriso_copy_properties(struct XorrisO *xorriso,
|
||||
}
|
||||
|
||||
|
||||
int Xorriso_add_symlink(struct XorrisO *xorriso, IsoDir *parent,
|
||||
char *link_target, char *leaf_name,
|
||||
char *nominal_path, int flag)
|
||||
{
|
||||
int ret= 0;
|
||||
IsoSymlink *link= NULL;
|
||||
|
||||
ret= iso_tree_add_new_symlink(parent, leaf_name, link_target, &link);
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
if(ret < 0) {
|
||||
Xorriso_report_iso_error(xorriso, nominal_path, ret,
|
||||
"Cannot create symbolic link", 0, "FATAL", 1);
|
||||
ret= 0;
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
/* @param boss_iter Opaque handle to be forwarded to actions in ISO image
|
||||
Set to NULL if calling this function from outside ISO world
|
||||
@param flag bit0= mkdir: graft in as empty directory, not as copy from disk
|
||||
@ -735,6 +753,8 @@ int Xorriso_copy_properties(struct XorrisO *xorriso,
|
||||
bit7= no special handling of split file directories
|
||||
bit8= hide in iso_rr
|
||||
bit9= hide in joliet
|
||||
bit10= ln -s: graft in as symbolic link.
|
||||
Link target is handed over in parameter disk_path.
|
||||
@return <=0 = error , 1 = added simple node , 2 = added directory ,
|
||||
3 = rejected
|
||||
*/
|
||||
@ -822,7 +842,7 @@ int Xorriso_graft_in(struct XorrisO *xorriso, void *boss_iter,
|
||||
path[SfileadrL - 1]= 0;
|
||||
apt= npt= path;
|
||||
|
||||
if(!(flag&1)) {
|
||||
if(!(flag & (1 | 1024))) {
|
||||
ret= lstat(disk_path, &stbuf);
|
||||
if(ret!=-1) {
|
||||
if(S_ISDIR(stbuf.st_mode))
|
||||
@ -951,6 +971,12 @@ attach_source:;
|
||||
if(flag&1) {
|
||||
/* directory node was created above */;
|
||||
|
||||
} else if(flag & 1024) {
|
||||
ret= Xorriso_add_symlink(xorriso, dir, disk_path, apt, img_path, 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
Xorriso_set_change_pending(xorriso, 0);
|
||||
|
||||
} else if(is_dir) {
|
||||
Xorriso_transfer_properties(xorriso, &stbuf, disk_path,
|
||||
(IsoNode *) dir, 4 | 32);
|
||||
@ -1102,6 +1128,11 @@ attach_source:;
|
||||
if(flag&1) {
|
||||
/* directory node was created above */;
|
||||
|
||||
} else if(flag & 1024) {
|
||||
ret= Xorriso_add_symlink(xorriso, dir, disk_path, apt, img_path, 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
|
||||
} else if(is_dir) {
|
||||
Xorriso_transfer_properties(xorriso, &stbuf, disk_path,
|
||||
(IsoNode *) dir, 4 | 32);
|
||||
|
Reference in New Issue
Block a user