Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaRHristov committed Sep 28, 2024
2 parents 3792666 + 8e26075 commit c206725
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 14 deletions.
7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ links = "tauri-plugin-fs"
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs"]

[package.metadata.platforms.support]
windows = { level = "full", notes = "" }
linux = { level = "full", notes = "No write access to `$RESOURCES` folder" }
macos = { level = "full", notes = "No write access to `$RESOURCES` folder" }
android = { level = "partial", notes = "Access is restricted to Application folder by default" }
ios = { level = "partial", notes = "Access is restricted to Application folder by default" }

[build-dependencies]
tauri-plugin = { workspace = true, features = ["build"] }
schemars = { workspace = true }
Expand Down
8 changes: 4 additions & 4 deletions Source/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -993,8 +993,8 @@ pub fn resolve_path<R: Runtime>(
.unwrap()
.clone()
.into_iter()
.chain(global_scope.allows().iter().map(|e| e.path.clone()))
.chain(command_scope.allows().iter().map(|e| e.path.clone()))
.chain(global_scope.allows().iter().filter_map(|e| e.path.clone()))
.chain(command_scope.allows().iter().filter_map(|e| e.path.clone()))
.collect(),
deny: webview
.fs_scope()
Expand All @@ -1003,8 +1003,8 @@ pub fn resolve_path<R: Runtime>(
.unwrap()
.clone()
.into_iter()
.chain(global_scope.denies().iter().map(|e| e.path.clone()))
.chain(command_scope.denies().iter().map(|e| e.path.clone()))
.chain(global_scope.denies().iter().filter_map(|e| e.path.clone()))
.chain(command_scope.denies().iter().filter_map(|e| e.path.clone()))
.collect(),
require_literal_leading_dot: webview.fs_scope().require_literal_leading_dot,
},
Expand Down
18 changes: 9 additions & 9 deletions Source/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,17 +353,17 @@ impl ScopeObject for scope::Entry {
app: &AppHandle<R>,
raw: Value,
) -> std::result::Result<Self, Self::Error> {
let entry = serde_json::from_value(raw.into()).map(|raw| {
let path = match raw {
scope::EntryRaw::Value(path) => path,
scope::EntryRaw::Object { path } => path,
};
Self { path }
let path = serde_json::from_value(raw.into()).map(|raw| match raw {
scope::EntryRaw::Value(path) => path,
scope::EntryRaw::Object { path } => path,
})?;

Ok(Self {
path: app.path().parse(entry.path)?,
})
match app.path().parse(path) {
Ok(path) => Ok(Self { path: Some(path) }),
#[cfg(not(target_os = "android"))]
Err(tauri::Error::UnknownPath) => Ok(Self { path: None }),
Err(err) => Err(err.into()),
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion Source/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub enum EntryRaw {

#[derive(Debug)]
pub struct Entry {
pub path: PathBuf,
pub path: Option<PathBuf>,
}

pub type EventId = u32;
Expand Down
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
<<<<<<< HEAD
"name": "@tauri-apps/plugin-fs",
=======
"authors": [
"Tauri Programme within The Commons Conservancy"
],
"dependencies": {
"@tauri-apps/api": "2.0.0-rc.5"
},
>>>>>>> 8e26075f323638da29dc792694d4514d76bc8dcc
"description": "Access the file system.",
"exports": {
"import": "./dist-js/index.js",
Expand Down

0 comments on commit c206725

Please sign in to comment.