-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Directory.deleteSync(recursive: true) throwing exception in Windows because directory is not empty. #16264
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
Comments
Hi, This is most likely due to the paths are growing out of size (256 chars on Windows). There is a way to get around this by prepending ?\ to your path, ensuring it's absolute and that it only contains '' (no '/') as path separators. Let me know if solves your problem. Cheers,
|
This comment was originally written by @bgourlie I tried prepending ?, I get the same exact exception, except that the path it's attempting to delete reflects the prepended characters. |
Yes, I'm sorry, I had briefly forgotten about an internal restriction we apply here. I'll see if I can get around to lifting that restriction as a step one.
|
I've lifted the restriction. You should be able to use the '?' workaround now. |
Issue #16356 has been merged into this issue. cc @sgjesse. |
Issue #18716 has been merged into this issue. |
Removed Area-IO label. |
Removed the owner. |
Also note that we should now return the correct OSError, and not just 'directory is not empty'. |
Using the ?\ prefix for long file names work on Windows. In dart:io we will not try to automatically change ling directory names to the ?\ form internally. Added AsDesigned label. |
This issue was originally filed by @bgourlie
While running tests in the angular.dart project, the following exception is being thrown:
Uncaught Error: FileSystemException: Deletion failed, path = C:\Users\WBRIAN~1.G
OU\AppData\Local\Temp\5f0862c7-844a-11e3-bead-3c970e7fe5b2 (OS Error: The direct
ory is not empty.
, errno = 145)
Stack Trace:
0 _Directory._deleteSync (directory_impl.dart:188)
1 FileSystemEntity.deleteSync (file_system_entity.dart:339)
2 main.<anonymous closure>.<anonymous closure>.<anonymous closure> (file:/
//C:/Users/w.brian.gourlie/Documents/GitHub/angular.dart/test/io/template_cache_
generator_spec.dart:33:24)
3 _Future._propagateToListeners.<anonymous closure> (dart:async/future_imp
l.dart:481)
4 _rootRun (dart:async/zone.dart:683)
5 _RootZone.run (dart:async/zone.dart:832)
6 _Future._propagateToListeners (dart:async/future_impl.dart:445)
7 _Future._complete (dart:async/future_impl.dart:303)
8 _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:
9 _asyncRunCallback (dart:async/schedule_microtask.dart:18)
10 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dar
t:119)
The code causing this exception is "tmpDir.deleteSync(recursive: true);"
I would expect this not to fail since it is a recursive delete.
Dart Editor version 1.1.1.release (STABLE)
Dart SDK version 1.1.1
Windows 8.1 x64
The text was updated successfully, but these errors were encountered: