Alex Tearse-Doyle <>
Thu Sep 3 03:11:26 CEST 2009

This patch adds support for both hard and symbolic linking  for Windows.

Hard linking requires XP and an NTFS formatted drive.
Symbolic linking on Windows requires either Windows Vista, Windows Server 2008, or Windows 7.   The Windows API call for creating symbolic links is dynamically executed via LoadLibrary, which allows a single binary to handle both the OS supported and OS not-supported cases.    For example calling file:make_symlink on a Windows XP will return {error, enotsup}, however the same call should work as expected on Windows Vista.

All the file module functions are supported:  make_link/2, make_sym_link/2, read_link/1,  and read_link_info/1. The normal read_info/1 gives the number of links and uses the target of a symbolic link.

On a side note, the file.erl man page, {error, exdev} isn't listed on file's man page as a valid return type for make_link, however the error is (correctly) returned when attempting to create a hard link to file on another volume (which should result in {error, exdev}).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20090902/18ec9dd0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: win_efile.diff
Type: application/octet-stream
Size: 5113 bytes
Desc: win_efile.diff
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20090902/18ec9dd0/attachment.obj>

More information about the erlang-patches mailing list