From ab50e4e5121c2c29b8a49916f8ac89e42e37a978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Rasc=C3=A3o?= Date: Fri, 27 Jun 2014 00:08:07 +0100 Subject: fix escript archive symlinked across drives real_path method used while prim loading archive files was not taking into account the fact that windows directory symlinks can be across different drives (eg. c:\tmp\test is a symlink to j:\tmp\test). when performing a path split the drive precedes the symlink, but that has be rewritten also since it's different. This issue never arises in Unix since obviously there are no drives --- erts/preloaded/src/erl_prim_loader.erl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/erts/preloaded/src/erl_prim_loader.erl b/erts/preloaded/src/erl_prim_loader.erl index 578913b633..dfd6151b69 100644 --- a/erts/preloaded/src/erl_prim_loader.erl +++ b/erts/preloaded/src/erl_prim_loader.erl @@ -1487,7 +1487,12 @@ real_path(Name,[Path|Paths],Acc,Links) -> [""|_] = LinkPaths -> real_path(Name,LinkPaths++Paths,[],[ThisFile|Links]); LinkPaths -> - real_path(Name,LinkPaths++Paths,Acc,[ThisFile|Links]) + case erlang:system_info(os_type) of + {win32, _} -> + real_path(Name,LinkPaths++Paths,[],[ThisFile|Links]); + _ -> + real_path(Name,LinkPaths++Paths,Acc,[ThisFile|Links]) + end end; _ -> real_path(Name,Paths,This,Links) -- cgit v1.2.3 From 81c2cd3755b4adb60d498b2763ee32279f3cfc0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Rasc=C3=A3o?= Date: Tue, 12 Aug 2014 22:40:28 +0100 Subject: fix indentation, add comment describing windows symlink creation assumption --- erts/preloaded/src/erl_prim_loader.erl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/erts/preloaded/src/erl_prim_loader.erl b/erts/preloaded/src/erl_prim_loader.erl index dfd6151b69..6953db533c 100644 --- a/erts/preloaded/src/erl_prim_loader.erl +++ b/erts/preloaded/src/erl_prim_loader.erl @@ -1487,11 +1487,13 @@ real_path(Name,[Path|Paths],Acc,Links) -> [""|_] = LinkPaths -> real_path(Name,LinkPaths++Paths,[],[ThisFile|Links]); LinkPaths -> + % windows currently does not allow creation of relative symlinks + % across different drives case erlang:system_info(os_type) of - {win32, _} -> - real_path(Name,LinkPaths++Paths,[],[ThisFile|Links]); - _ -> - real_path(Name,LinkPaths++Paths,Acc,[ThisFile|Links]) + {win32, _} -> + real_path(Name,LinkPaths++Paths,[],[ThisFile|Links]); + _ -> + real_path(Name,LinkPaths++Paths,Acc,[ThisFile|Links]) end end; _ -> -- cgit v1.2.3