Bug 21010 – Windows symlinks

Status
NEW
Severity
major
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2020-07-04T01:12:49Z
Last change time
2024-12-01T16:37:14Z
Assigned to
No Owner
Creator
srpen6
Depends on
21306
Moved to GitHub: phobos#10428 →

Comments

Comment #0 by srpen6 — 2020-07-04T01:12:49Z
Windows symlinks It seems currently D cannot create Symlinks on Windows: https://dlang.org/library/std/file/symlink.html but I dont really see a good reason why this is the case. Plenty of other languages offer this, such as Go: https://golang.org/pkg/os#Symlink Nim: https://nim-lang.org/docs/os.html#createSymlink,string,string PHP: https://php.net/function.symlink Python: https://docs.python.org/library/os#os.symlink Dart: https://api.dart.dev/dart-io/Link/create.html
Comment #1 by starcanopy — 2020-10-12T13:32:23Z
I'll look into it.
Comment #2 by starcanopy — 2020-10-12T17:15:06Z
Adding Windows support to std.file.symlink is mostly done. I just need to get some clarification about some stuff. For std.file.readLink, druntime is missing a conversion of Fileapi.h, and this is the header that declares the function to retrieve the target's path, GetFinalPathNameByHandle[A|W]. For this issue's resolution, I feel that both readLink and symlink need to be simultaneously added.
Comment #3 by starcanopy — 2020-11-07T01:23:45Z
A potential blocker for this issue's resolution is that Windows (10) necessitates enabling Developer Mode to utilize symlinks. Thus, unless the CIs' Windows hosts may and might be configured to do this, then the Windows' version of `symlink` cannot have a unittest. If that's not acceptable, then this issue should be closed, and the documentation of symlink should inform users of `core.sys.windows.symlink`'s presence. (As of now, the docs merely specify that only POSIX is supported, and I think mentioning that directly utilizing the WinAPI is easy.) The other pertinent function, `readLink`, is also affected.
Comment #4 by starcanopy — 2020-11-07T01:37:25Z
After more thinking, and thanks to another individual, for the unittests to properly function on all supported versions of Windows, administrative rights must be conferred. (Developer Mode is an exclusive feature of Windows 10.) Whether this is possible or prudent, I do no know.
Comment #5 by robert.schadek — 2024-12-01T16:37:14Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10428 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB