Skip to content

Path.is_dir returns false for folders in OneDrive using "Files On Demand" #46484

@roblourens

Description

@roblourens

Files On Demand is a new OneDrive feature that only downloads files to the local disk when needed.

  • Install the latest Windows and OneDrive updates
  • Open OneDrive settings, enable Files On Demand
  • Run this code with the path to your OneDrive folder:
    let metadata = Path::new("C:\\Users\\roblourens\\OneDrive").metadata().expect("failed");

    println!("{:?}", metadata.file_type());
    println!("{:?}", metadata.is_dir());
    println!("{:?}", metadata.is_file());
    println!("{:?}", metadata.len());

Output:

FileType(ReparsePoint)
false
false
4096

Here's a PR in libuv that fixed an issue with Files On Demand, in case there's a similar issue in Rust: https://github.com/libuv/libuv/pull/1522/files

Ref: BurntSushi/ripgrep#705 and microsoft/vscode#35433

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.O-windowsOperating system: Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions