Skip to content
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ document-features = { version = "0.2.12", optional = true }
futures = "0.3.32"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokio = { version = "1.52.3", default-features = false, features = ["sync", "rt-multi-thread", "macros", "fs"] }
tokio = { version = "1.52.3", default-features = false, features = ["sync", "rt-multi-thread", "macros"] }
[target.'cfg(target_arch = "wasm32")'.dependencies]
tokio = { version = "1.52.3", default-features = false, features = ["sync", "rt", "macros"] }

Expand Down
24 changes: 10 additions & 14 deletions src/file_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,13 @@ impl FileSystem for FileSystemOs {
if self.options.enable_pnp {
return match VPath::from(path)? {
VPath::Zip(info) => self.pnp_lru.read(info.physical_base_path(), info.zip_path),
VPath::Virtual(info) => tokio::fs::read(info.physical_base_path()).await,
VPath::Native(path) => tokio::fs::read(&path).await,
VPath::Virtual(info) => fs::read(info.physical_base_path()),
VPath::Native(path) => fs::read(&path),
}
}
}}

tokio::fs::read(path).await
fs::read(path)
Comment thread
stormslowly marked this conversation as resolved.
}

async fn read_to_string(&self, path: &Path) -> io::Result<String> {
Expand All @@ -168,13 +168,13 @@ impl FileSystem for FileSystemOs {
if self.options.enable_pnp {
return match VPath::from(path)? {
Comment thread
stormslowly marked this conversation as resolved.
VPath::Zip(info) => self.pnp_lru.read_to_string(info.physical_base_path(), info.zip_path),
VPath::Virtual(info) => tokio::fs::read_to_string(info.physical_base_path()).await,
VPath::Native(path) => tokio::fs::read_to_string(&path).await,
VPath::Virtual(info) => fs::read_to_string(info.physical_base_path()),
VPath::Native(path) => fs::read_to_string(&path),
}
}
}
}
tokio::fs::read_to_string(path).await
fs::read_to_string(path)
}

async fn metadata(&self, path: &Path) -> io::Result<FileMetadata> {
Expand All @@ -187,23 +187,19 @@ impl FileSystem for FileSystemOs {
.file_type(info.physical_base_path(), info.zip_path)
.map(FileMetadata::from),
VPath::Virtual(info) => {
tokio::fs::metadata(info.physical_base_path())
.await
.map(FileMetadata::from)
fs::metadata(info.physical_base_path()).map(FileMetadata::from)
}
VPath::Native(path) => tokio::fs::metadata(path).await.map(FileMetadata::from),
VPath::Native(path) => fs::metadata(path).map(FileMetadata::from),
}
}
}
}

tokio::fs::metadata(path).await.map(FileMetadata::from)
fs::metadata(path).map(FileMetadata::from)
}

async fn symlink_metadata(&self, path: &Path) -> io::Result<FileMetadata> {
tokio::fs::symlink_metadata(path)
.await
.map(FileMetadata::from)
fs::symlink_metadata(path).map(FileMetadata::from)
}

async fn canonicalize(&self, path: &Path) -> io::Result<PathBuf> {
Expand Down
Loading