opendal icon indicating copy to clipboard operation
opendal copied to clipboard

Operator::lister_with should have an option to return itself if it's already a file path

Open sundy-li opened this issue 1 year ago • 1 comments

Currently

pub fn lister_with(&self, path: &str) -> FutureList<impl Future<Output = Result<Lister>>>

will list the files inside the path. But if the path is already a file, we also need to return itself.

So maybe we could have an option, eg:

pub fn with_self(self, v: bool) -> Self {
        self.map(|args| args.with_self(v))
}

Which could also return the existing path if it's set true.

sundy-li avatar Apr 23 '24 03:04 sundy-li

I don't think we should add a new option for this. Maybe we should let services return the path itself if it exists.

For example:

a/
a/b
a/bb
a/c
  • list("a/") -> a/b, a/bb, a/c
  • list("a/b") -> a/b, a/bb

Xuanwo avatar Apr 23 '24 04:04 Xuanwo

We are returning the dir path itself now.

Xuanwo avatar Mar 12 '25 13:03 Xuanwo