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

Bug: Directory.watch() emits incorrect isDirectory #55130

Closed
IrisDAnte opened this issue Mar 7, 2024 · 1 comment
Closed

Bug: Directory.watch() emits incorrect isDirectory #55130

IrisDAnte opened this issue Mar 7, 2024 · 1 comment
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. closed-as-intended Closed as the reported issue is expected behavior docs-api library-io P2 A bug or feature request we're likely to work on triaged Issue has been triaged by sub team

Comments

@IrisDAnte
Copy link

IrisDAnte commented Mar 7, 2024

I've encountered a bug with the Directory.watch() function in Dart on Linux and Windows. When a directory is deleted, the function does emit a delete event as expected. However, the event.isDirectory property incorrectly returns false.

Steps to Reproduce

Here's a simple Dart program that reproduces the issue:

import 'dart:io';

main() {
  Directory('./').watch().listen((event) {
    print([event.type, event.isDirectory]);
  });
}

When you run this program and delete a directory in the current working directory, the console output indicates that event.isDirectory is false, which is not the expected behavior.

Expected Behavior

When a directory is deleted, I expect the event.isDirectory property of the delete event to be true.

Actual Behavior

The event.isDirectory property of the delete event is false when a directory is deleted.

Environment

Dart SDK Version: 3.3.0 (stable)
Operating System and version: Ubuntu 22.04.3 LTS, Windows 11 22H2

@IrisDAnte IrisDAnte changed the title Bug: Directory.watch() emits incorrect isDirectory value on Linux Bug: Directory.watch() emits incorrect isDirectory value on Linux Mar 7, 2024
@IrisDAnte IrisDAnte changed the title Bug: Directory.watch() emits incorrect isDirectory value on Linux Bug: Directory.watch() emits incorrect isDirectory Mar 7, 2024
@lrhn lrhn added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. library-io labels Mar 7, 2024
@a-siva a-siva added P2 A bug or feature request we're likely to work on triaged Issue has been triaged by sub team labels Mar 13, 2024
@brianquinlan
Copy link
Contributor

This is working working as intended - isDirectory is always false for FileSystemDeleteEvent. I have a PR in progress to clarify this:

https://dart-review.googlesource.com/c/sdk/+/357663

copybara-service bot pushed a commit that referenced this issue Mar 30, 2024
…leteEvent.

Bug: #55130
Change-Id: I43c95218cd9f6b87ab242affa8cc2b9d42df7d96
CoreLibraryReviewExempt: documentation-only change
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357663
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
@a-siva a-siva added the closed-as-intended Closed as the reported issue is expected behavior label Apr 1, 2024
@a-siva a-siva closed this as completed Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. closed-as-intended Closed as the reported issue is expected behavior docs-api library-io P2 A bug or feature request we're likely to work on triaged Issue has been triaged by sub team
Projects
None yet
Development

No branches or pull requests

4 participants