-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Relative links to directories don't work on Windows #53689
Comments
Issue exists for directories only (changed title accordingly). Test below works well on both Windows and Linux import "dart:io";
main() async {
Directory sandbox = Directory.systemTemp.createTempSync();
try {
File target =
new File(sandbox.path + Platform.pathSeparator + "file.txt");
target.createSync();
Link link = new Link(sandbox.path + Platform.pathSeparator + "link.lnk");
await link.create("file.txt").then((Link created) {
print(created.targetSync()); // Linux: file.txt, Windows: file.txt
print(FileSystemEntity.typeSync(created.path)); // Linux: file, Windows: file
print(created.resolveSymbolicLinksSync()); // Linux: /tmp/XNQSRN/file.txt, Windows: C:\Users\sgrek\AppData\Local\Temp\fd9d7667\file.txt
// Now create a directory and move the link to it. Its relative path
// should point to a not existing entity after it
Directory dir = sandbox.createTempSync();
Link moved =
created.renameSync(dir.path + Platform.pathSeparator + "moved.lnk");
print(moved.targetSync()); // Linux: file.txt, Windows: file.txt
print(FileSystemEntity.typeSync(moved.path)); // Linux: notFound, Windows: link
});
} finally {
sandbox.deleteSync(recursive: true);
}
} |
I can't reproduce this. The output using Dart 3.4.0 is:
Possibly this was fixed in 097c84f ? If these tests are disabled in |
Yes, the issue was fixed in 097c84f and appropriate co19 tests were updated accordingly. |
Link.create()
documentation says nothing special about relative links on Windows. So, seems, that they should work. But they don't. For example, the tests below works well on Linux but fails on WindowsOn Windows,
Link
pointing to a not existing entity has typelink
(see #53684 (comment)). So, exception is, probably, also caused by the fact that relative link on Windows cannot find its target. Anyway, please fix it or document that relative links on Windows not supported or have some limitationsProbably this is the same issue as #45981
Tested on
Dart SDK version: 3.2.0-228.0.dev (dev) (Tue Oct 3 21:02:12 2023 -0700) on "windows_x64"
The text was updated successfully, but these errors were encountered: