Skip to content
This repository has been archived by the owner on Jun 4, 2019. It is now read-only.

Commit

Permalink
* main_test.ml: -relatavitze symlink
Browse files Browse the repository at this point in the history
  • Loading branch information
pad committed Oct 8, 2014
1 parent ead9dbd commit 7f1b011
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions main_test.ml
Expand Up @@ -219,6 +219,22 @@ let pfff_extra_actions () = [
| _ -> failwith "too many candidates"
);

"-relativize", "<dir>", Common.mk_action_1_arg (fun dir ->
let dir = Common.realpath dir in
let candidates = Common.cmd_to_list (spf "find %s -type l" dir) in
let root = "/Users/yoann.padioleau/github/xix/xix-plan9/" in
candidates +> List.iter (fun link ->
let dst = Unix.readlink link in
if not (Filename.is_relative dst)
then begin
let readable = Common.readable ~root dst in
pr2 (spf "%s -> %s" link readable);
let newdst = "../../../../" ^ readable in
let cmd = spf "rm %s; ln -s %s %s" link newdst link in
Common.command2 cmd;
end;
);
);
]

(*****************************************************************************)
Expand Down

0 comments on commit 7f1b011

Please sign in to comment.