From 9e3a87054e841804c45c83e0b0f68c439e224ec4 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 10 Mar 2020 15:27:16 +0300 Subject: On Windows try to create directory symlink and fallback to creating junction on error --- libbutl/filesystem.mxx | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'libbutl/filesystem.mxx') diff --git a/libbutl/filesystem.mxx b/libbutl/filesystem.mxx index 186c9db..5bb1ac2 100644 --- a/libbutl/filesystem.mxx +++ b/libbutl/filesystem.mxx @@ -248,18 +248,15 @@ LIBBUTL_MODEXPORT namespace butl // Developer Mode enabled or if the process runs in the elevated command // prompt. // - // - Directory symlinks are implemented via the Windows junction mechanism - // that doesn't require a process to have administrative privileges and so - // a junction can be created regardless of the Windows version and mode. - // Note that junctions, in contrast to symlinks, may only store target - // absolute paths. Thus, when create a directory symlink we complete its - // target path against the current directory (unless it is already - // absolute) and normalize. - // - // (@@ TODO: At some point we may want to support creating directory - // symlinks if possible and falling back to junctions otherwise. One - // potential issue here is with relative target paths which the caller - // cannot rely on staying relative.) + // - Directory symlinks are implemented via the Windows symlink mechanism if + // possible (see above) and via the Windows junction mechanism otherwise. + // Note that creating a junction doesn't require a process to have + // administrative privileges and so succeeds regardless of the Windows + // version and mode. Also note that junctions, in contrast to symlinks, + // may only store target absolute paths. Thus, when create a junction we + // complete its target path against the current directory (unless it is + // already absolute) and normalize, which makes it impossible for a + // mksymlink() caller to rely on target path staying relative. // // - Functions other than mksymlink() fully support symlinks, considering // the Windows file symlinks (file-type reparse points referring to files) -- cgit v1.1