-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
dart:io file api doesn't work with long file names on windows #42416
Comments
I'm looking at the APIs and try to add to our VM. I think your example is not going to work. The file name itself (4 * 100) has exceeded the limit.
@sigurdm I'm trying to experiment on my Windows machine. How did you enable the "long path"? I've modified the registry key and reboot my machine. But I'm still not able to create a file with path longer than |
If you clone https://github.com/dart-lang/pana and run |
https://dart-review.googlesource.com/c/sdk/+/152736 is working in progress, which will enable the long path on Windows. One problem with cl is Another solution can be added in the future is to embed the manifest into dart.exe which enables long path. The drawback of this solution is that this isn't supported on earlier versions of Windows. |
File APIs on Windows can now handle files and directories identified by long paths (greater than 260 characters). For directory, the limit is 248. Some restrictions from Windows: 1. The size limit for long path is 32,767 characters. 2. Each component separated by backslashes should not be more than 255 characters. Reference: https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation. Note that `Directory.current` does not work with long path. Bug: #42416 Change-Id: Ia1b4608d393fb36f1d843858c6f076f3c825dc83 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152736 Reviewed-by: Alexander Aprelev <aam@google.com> Commit-Queue: Zichang Guo <zichangguo@google.com>
This reverts commit 08662f0. Reason for revert: failure on pkg-win-release, https://dart-ci.appspot.com/log/pkg-win-release/unittest-asserts-release-win/12878/pkg/dartdev/test/commands/test_test Original change's description: > Enable long path on Windows > > File APIs on Windows can now handle files and directories identified by > long paths (greater than 260 characters). For directory, the limit is > 248. > > Some restrictions from Windows: > 1. The size limit for long path is 32,767 characters. > 2. Each component separated by backslashes should not be more than 255 > characters. > > Reference: https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation. > > Note that `Directory.current` does not work with long path. > > Bug: #42416 > Change-Id: Ia1b4608d393fb36f1d843858c6f076f3c825dc83 > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152736 > Reviewed-by: Alexander Aprelev <aam@google.com> > Commit-Queue: Zichang Guo <zichangguo@google.com> TBR=aam@google.com,zra@google.com,zichangguo@google.com Change-Id: If6701c887e616cd62f20faac43f601cfb53ed349 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: #42416 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162104 Reviewed-by: Zichang Guo <zichangguo@google.com> Commit-Queue: Zichang Guo <zichangguo@google.com>
Dart version: Dart VM version: 2.8.4 (stable) (Wed Jun 3 12:26:04 2020 +0200) on "windows_x64"
Windows 10 Enterprise
Reproduction:
Prints:
The program works if the name is shorter.
The same happens if I try deleting a directory containing files with long names with
Directory.delete(recursive:true);
. (That's how I stumbled into this).According to https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation there should be ways of enabling long paths on windows 10.
The text was updated successfully, but these errors were encountered: