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

feat: use std::path::Path for fs backend #1100

Merged
merged 6 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/service_test_fs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
matrix:
os:
- ubuntu-latest
- windows-latest
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
Expand All @@ -31,4 +32,4 @@ jobs:
RUST_BACKTRACE: full
RUST_LOG: debug
OPENDAL_FS_TEST: on
OPENDAL_FS_ROOT: /tmp/
OPENDAL_FS_ROOT: ${{ runner.temp }}/
12 changes: 11 additions & 1 deletion binaries/oli/src/utils/location.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,17 @@ use std::str::FromStr;
/// Parse `s3://abc/def` into `op` and `location`.
pub fn parse_location(s: &str) -> Result<(Operator, &str)> {
if !s.contains("://") {
return Ok((Operator::create(services::Fs::default())?.finish(), s));
let mut fs = services::Fs::default();

let filename = match s.rsplit_once(['/', '\\']) {
Some((base, filename)) => {
fs.root(base);
filename
}
None => s,
};

return Ok((Operator::create(fs)?.finish(), filename));
}

let s = s.splitn(2, "://").collect::<Vec<_>>();
Expand Down
Loading