Skip to content
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

Directory.deleteSync(recursive: true) throwing exception in Windows because directory is not empty. #16264

Closed
DartBot opened this issue Jan 23, 2014 · 11 comments
Labels
closed-as-intended Closed as the reported issue is expected behavior library-io

Comments

@DartBot
Copy link

DartBot commented Jan 23, 2014

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

@lrhn
Copy link
Member

lrhn commented Jan 23, 2014

Added Area-IO, Triaged labels.

@andersjohnsen
Copy link

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,

  • Anders

@DartBot
Copy link
Author

DartBot commented Jan 30, 2014

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.

@andersjohnsen
Copy link

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.

  • Anders
    Set owner to @skabet.

@andersjohnsen
Copy link

I've lifted the restriction. You should be able to use the '?' workaround now.

@andersjohnsen
Copy link

Issue #16356 has been merged into this issue.


cc @sgjesse.
cc @munificent.
cc @mkustermann.
cc @whesse.

@andersjohnsen
Copy link

Issue #18716 has been merged into this issue.

@kevmoo
Copy link
Member

kevmoo commented May 14, 2014

Removed Area-IO label.
Added Library-IO label.

@andersjohnsen
Copy link

Removed the owner.

@andersjohnsen
Copy link

Also note that we should now return the correct OSError, and not just 'directory is not empty'.

@sgjesse
Copy link
Contributor

sgjesse commented Mar 24, 2015

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 closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-as-intended Closed as the reported issue is expected behavior library-io
Projects
None yet
Development

No branches or pull requests

5 participants