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

FileSystemMoveEvent.isDirectory is True for Link #30644

Open
sgrekhov opened this issue Sep 7, 2017 · 0 comments
Open

FileSystemMoveEvent.isDirectory is True for Link #30644

sgrekhov opened this issue Sep 7, 2017 · 0 comments
Assignees
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io

Comments

@sgrekhov
Copy link
Contributor

sgrekhov commented Sep 7, 2017

The code below creates temp directory, file inside it and the link to this file. Then link is renamed and FileSystemMoveEvent is fired. But FileSystemMoveEvent.isDirectory has wrong value (true). No issue when renaming File or Directory

import "dart:io";
import "dart:async";

main() {
  Directory dir = new Directory(Directory.systemTemp.path + Platform.pathSeparator + "testDir");
  dir.createSync();
  File target = new File(dir.path + Platform.pathSeparator + "testFile.tmp");
  target.createSync();
  StreamSubscription s = dir.watch().listen((FileSystemEvent event) {
    if (event is FileSystemMoveEvent) {
      print(event); // FileSystemMoveEvent('C:\Users\sgrekhov\AppData\Local\Temp\testDir\testLink1.lnk', 'C:\Users\sgrekhov\AppData\Local\Temp\testDir\testLink2.lnk')
      print(event.isDirectory); // true
    }
  });

// Create link to the target file
  Link link = new Link(dir.path + Platform.pathSeparator + "testLink1.lnk");
  link.createSync(target.path);
  link.renameSync(dir.path + Platform.pathSeparator + "testLink2.lnk");

// Wait for 1 second and then cleanup
  new Future.delayed(new Duration(seconds: 1), () {
    s.cancel().then((_) {
      dir.delete(recursive: true);
    });
  });
}

May be this is related with #30359.
Tested on Dart VM version: 1.25.0-dev.16.0 (Tue Sep 05 08:14:58 2017) on "windows_x64"

@a-siva a-siva added the area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. label Sep 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io
Projects
None yet
Development

No branches or pull requests

3 participants