mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-08-13 18:50:20 +02:00
feat(fs): improved API (#751)
* feat(fs): improved API * fmt * fix unix builds * again * clippy * clippy * fix import in docs examples * fmt, clippy * Update linux.rs * add API for watch * fix with `watcher` feature flag * use baseDir for all commands * do not export close function * fix build * organize and address review comments * fmt * generated files * rename FsFile to FileHandle, move APIs and docs * extend example * extend `Resource` * actually extend it --------- Co-authored-by: FabianLars <fabianlars@fabianlars.de> Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
This commit is contained in:
co-authored by
FabianLars
Lucas Nogueira
parent
2cf8faa3e1
commit
69a1fa099c
+19
-10
@@ -49,17 +49,29 @@ pub fn init<R: Runtime>() -> TauriPlugin<R, Option<Config>> {
|
||||
PluginBuilder::<R, Option<Config>>::new("fs")
|
||||
.js_init_script(include_str!("api-iife.js").to_string())
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
commands::create,
|
||||
commands::open,
|
||||
commands::copy_file,
|
||||
commands::close,
|
||||
commands::mkdir,
|
||||
commands::read_dir,
|
||||
commands::read,
|
||||
commands::read_file,
|
||||
commands::read_text_file,
|
||||
commands::read_text_file_lines,
|
||||
commands::read_text_file_lines_next,
|
||||
commands::remove,
|
||||
commands::rename,
|
||||
commands::seek,
|
||||
commands::stat,
|
||||
commands::lstat,
|
||||
commands::fstat,
|
||||
commands::truncate,
|
||||
commands::ftruncate,
|
||||
commands::write,
|
||||
commands::write_file,
|
||||
commands::read_dir,
|
||||
commands::copy_file,
|
||||
commands::create_dir,
|
||||
commands::remove_dir,
|
||||
commands::remove_file,
|
||||
commands::rename_file,
|
||||
commands::write_text_file,
|
||||
commands::exists,
|
||||
commands::metadata,
|
||||
#[cfg(feature = "watch")]
|
||||
watcher::watch,
|
||||
#[cfg(feature = "watch")]
|
||||
@@ -75,9 +87,6 @@ pub fn init<R: Runtime>() -> TauriPlugin<R, Option<Config>> {
|
||||
.unwrap_or(&default_scope),
|
||||
)?);
|
||||
|
||||
#[cfg(feature = "watch")]
|
||||
app.manage(watcher::WatcherCollection::default());
|
||||
|
||||
Ok(())
|
||||
})
|
||||
.on_event(|app, event| {
|
||||
|
||||
Reference in New Issue
Block a user