mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2026-10-19 09:22:12 +00:00
clarify filename
This commit is contained in:
1 parent
11709316d2
commit
adbf89e318
16 files changed
+573
-61
No files matched your search
@@ -1,15 +1,28 @@
|
||||
//! Editing the metadata, the style, the structure and the waypoints of the files, and the tools:
|
||||
//! reversing, cropping, reducing, timestamps, merging, cleaning...
|
||||
|
||||
use gpx_engine::{CleanType, MergeType, SplitType, api};
|
||||
use gpx_engine::{CleanType, FileId, MergeType, Selection, SplitType, api};
|
||||
use tauri::State;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::state::AppState;
|
||||
|
||||
/// Names and describes the selected files or tracks. A file on the disk is renamed with it (and back
|
||||
/// when it is undone): its name is one that a file can have, and not the one of another file.
|
||||
#[tauri::command(async)]
|
||||
pub fn metadata(state: State<AppState>, name: String, desc: String) -> api::Outcome {
|
||||
state.run(move |e| api::metadata(e, &name, &desc))
|
||||
state.core(move |core| {
|
||||
let mut name = name;
|
||||
if let Selection::File { file_ids } = core.engine.selection() {
|
||||
for FileId(id) in file_ids.clone() {
|
||||
name = core.workspace.valid_name(id, &name);
|
||||
if let Err(error) = core.workspace.renamed_path(id, &name) {
|
||||
return api::Outcome::failed(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
core.edit(move |e| api::metadata(e, &name, &desc))
|
||||
})
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
|
||||
Reference in new issue
Block a user