mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2026-11-30 09:34:29 +00:00
Compare commits
351
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c70e7be4c8 | ||
|
|
156c776625 | ||
|
|
376189f374 | ||
|
|
ab874a66b6 | ||
|
|
079f4a94d5 | ||
|
|
e027137e90 | ||
|
|
25e491f34b | ||
|
|
0a15f574fc | ||
|
|
e9ad679861 | ||
|
|
0a1f42d181 | ||
|
|
9f2a805a78 | ||
|
|
35190b9bec | ||
|
|
732aebd098 | ||
|
|
d6aeaadfda | ||
|
|
0e81a4c87c | ||
|
|
d78aa9653f | ||
|
|
d4064b7d03 | ||
|
|
2dd766795e | ||
|
|
03581a7433 | ||
|
|
73438cc158 | ||
|
|
4b1d1c6f1a | ||
|
|
9bf6bedc42 | ||
|
|
4655cc306e | ||
|
|
5f995f7fd1 | ||
|
|
aef5e2fbeb | ||
|
|
cb3636a892 | ||
|
|
9154bd6b85 | ||
|
|
6913390897 | ||
|
|
06b588606c | ||
|
|
46b9d79d71 | ||
|
|
d325e732e9 | ||
|
|
940d7427c6 | ||
|
|
0c2110f438 | ||
|
|
d1d73b3e82 | ||
|
|
a6648ab198 | ||
|
|
6edb7d25bf | ||
|
|
efdb3fd079 | ||
|
|
6a11bd0536 | ||
|
|
f9c9fe44df | ||
|
|
0d167a431c | ||
|
|
a60a1cf402 | ||
|
|
0e458f4ef1 | ||
|
|
dfa08282cc | ||
|
|
05ea01557d | ||
|
|
c0cb38daba | ||
|
|
9e1023097a | ||
|
|
aadfc58fda | ||
|
|
bdc71b900f | ||
|
|
b5bbff69b8 | ||
|
|
a8137b10f7 | ||
|
|
36341ca271 | ||
|
|
72582ee72a | ||
|
|
fb1d06d7f9 | ||
|
|
2d8e81f1cf | ||
|
|
11063b7083 | ||
|
|
cd217b8970 | ||
|
|
4afc00861b | ||
|
|
b7b2873955 | ||
|
|
55cc34d89b | ||
|
|
0048ef4de3 | ||
|
|
91bd983e71 | ||
|
|
3fc60ac193 | ||
|
|
ed9aa5092f | ||
|
|
70a5e9f5c1 | ||
|
|
f2f0dcd137 | ||
|
|
43e880c693 | ||
|
|
7603217eb1 | ||
|
|
01a643eded | ||
|
|
569799c7b8 | ||
|
|
99c7252898 | ||
|
|
a5c5b6c5b1 | ||
|
|
ccf1d51871 | ||
|
|
36354d9318 | ||
|
|
5e4808828e | ||
|
|
9a4c124274 | ||
|
|
12e37f147f | ||
|
|
fadc8f91a3 | ||
|
|
66994aa717 | ||
|
|
b98c4986d8 | ||
|
|
4f7cfdd3fd | ||
|
|
24299b0e30 | ||
|
|
5131d7cb0c | ||
|
|
e551d6e47a | ||
|
|
dbbd1e58c8 | ||
|
|
144d291ab2 | ||
|
|
2334ba9312 | ||
|
|
23a942bb6c | ||
|
|
905b886af1 | ||
|
|
9bd499f8b0 | ||
|
|
bbb5b0605d | ||
|
|
b1a0a11999 | ||
|
|
56513014c9 | ||
|
|
9acf0401a4 | ||
|
|
2dd9ba098d | ||
|
|
da133b1f58 | ||
|
|
c2d6d17ed1 | ||
|
|
3148eef378 | ||
|
|
4f2a6761c8 | ||
|
|
b6d438da7c | ||
|
|
de0bef3d64 | ||
|
|
b37f4f8300 | ||
|
|
55bc0ab0f6 | ||
|
|
fed18c1d6b | ||
|
|
bd18f3c2e9 | ||
|
|
56999823ba | ||
|
|
5e3b06e031 | ||
|
|
bde3dc14d2 | ||
|
|
de36c43b1c | ||
|
|
e5cf0f1ec7 | ||
|
|
ecaaac7687 | ||
|
|
ae4ed8b702 | ||
|
|
4517d0a863 | ||
|
|
2f7e71d239 | ||
|
|
a93ba2fa81 | ||
|
|
2df63f6b1b | ||
|
|
f035ecb3ca | ||
|
|
15b71a9cb3 | ||
|
|
7b877aa64f | ||
|
|
5ce1179324 | ||
|
|
8d923b2c5b | ||
|
|
70cad0450a | ||
|
|
71144c97c7 | ||
|
|
f6767b0503 | ||
|
|
859a0ca040 | ||
|
|
79cb10e69d | ||
|
|
1bfe46bf3e | ||
|
|
e587402ed3 | ||
|
|
7e9bbda0cf | ||
|
|
d867926e8b | ||
|
|
195dc98c04 | ||
|
|
84709fe856 | ||
|
|
c2c239c17e | ||
|
|
d29c378529 | ||
|
|
a20b739a0b | ||
|
|
f4e9101e17 | ||
|
|
d06d758c41 | ||
|
|
a42d1fe245 | ||
|
|
0c892aa563 | ||
|
|
fd953d4886 | ||
|
|
bf9c48452b | ||
|
|
b9f76f4e97 | ||
|
|
c40f7879fa | ||
|
|
5acc29b036 | ||
|
|
72a2fef5ba | ||
|
|
0f2d081a16 | ||
|
|
9d99d2774f | ||
|
|
cc5881126c | ||
|
|
e11e7fcce3 | ||
|
|
ec99e7bc74 | ||
|
|
8b286ed5df | ||
|
|
a0c215a80d | ||
|
|
0895e2abfd | ||
|
|
8044474379 | ||
|
|
28ae3de137 | ||
|
|
218d61ec89 | ||
|
|
eb32fd1b1e | ||
|
|
c8e201ade5 | ||
|
|
d284d172d2 | ||
|
|
102cbc756c | ||
|
|
3c1c4259d8 | ||
|
|
8941fbc264 | ||
|
|
8e994385bc | ||
|
|
5c11958707 | ||
|
|
9104745aec | ||
|
|
b0c999392d | ||
|
|
02bbc8b84e | ||
|
|
e074f378f7 | ||
|
|
36cf057963 | ||
|
|
6587afb864 | ||
|
|
7162d91902 | ||
|
|
6012082a05 | ||
|
|
056edf8a12 | ||
|
|
b089bfba1e | ||
|
|
87ba2ac8e6 | ||
|
|
abe0727191 | ||
|
|
9b1c151162 | ||
|
|
11e140b84e | ||
|
|
60c68353d0 | ||
|
|
3747f7012e | ||
|
|
decb647f5b | ||
|
|
1807fc85d7 | ||
|
|
0b78c80df3 | ||
|
|
a820cfb0a0 | ||
|
|
4646fa9775 | ||
|
|
2e21bf0ab0 | ||
|
|
3a236ff1df | ||
|
|
0b00d4c4f8 | ||
|
|
0edaf85238 | ||
|
|
6927fde583 | ||
|
|
6f70912c62 | ||
|
|
94b339859b | ||
|
|
24d790ca1e | ||
|
|
4af811f7fe | ||
|
|
c20ee2aafa | ||
|
|
2aacf38a38 | ||
|
|
93bb938bed | ||
|
|
a83db058fe | ||
|
|
447d9519bc | ||
|
|
cce9146a77 | ||
|
|
a43841547b | ||
|
|
35c67c6c1b | ||
|
|
4ed5c14ec7 | ||
|
|
4bd203a86b | ||
|
|
2a803d62c6 | ||
|
|
c547547c37 | ||
|
|
902164b103 | ||
|
|
291f4b211b | ||
|
|
6adffff3ca | ||
|
|
d84994f4dc | ||
|
|
9a70531016 | ||
|
|
68682dae4c | ||
|
|
648817bfd7 | ||
|
|
33947f83f0 | ||
|
|
5a13993d82 | ||
|
|
64fa842738 | ||
|
|
bbe6307f75 | ||
|
|
65cf6287ef | ||
|
|
ad0bf54db1 | ||
|
|
e4ce853943 | ||
|
|
ed87235c3e | ||
|
|
35d6d0502d | ||
|
|
198eabc3be | ||
|
|
8d1ee6b950 | ||
|
|
e49f867924 | ||
|
|
cb6a838a17 | ||
|
|
6c74c68d67 | ||
|
|
9473d691eb | ||
|
|
772edf13c1 | ||
|
|
267069f857 | ||
|
|
c068ab8e4e | ||
|
|
ca412e7468 | ||
|
|
76a11aaaf4 | ||
|
|
d5b563fbe2 | ||
|
|
e2b81f2197 | ||
|
|
5b4e1c4a14 | ||
|
|
0732bd5e6b | ||
|
|
d1765a9c1c | ||
|
|
061c7c0383 | ||
|
|
da46008eab | ||
|
|
a28a5c8e1f | ||
|
|
5006e25521 | ||
|
|
19be255376 | ||
|
|
762f76d9bf | ||
|
|
dd429a2e2b | ||
|
|
24ed6062e6 | ||
|
|
1eade11796 | ||
|
|
b5120799ca | ||
|
|
493a9c1c47 | ||
|
|
5078f4f00e | ||
|
|
2999ec9d3f | ||
|
|
d842843d4b | ||
|
|
cfe64a6c63 | ||
|
|
1541e34965 | ||
|
|
c93b3eb583 | ||
|
|
de4e8403ef | ||
|
|
32bcfa87e4 | ||
|
|
128678b23f | ||
|
|
4610e81dee | ||
|
|
ae56894654 | ||
|
|
dddad2c37d | ||
|
|
84de9548ad | ||
|
|
8f06f7eb6c | ||
|
|
fb4cfbcb4d | ||
|
|
d89fc82160 | ||
|
|
bde5217222 | ||
|
|
e2f6b81dd6 | ||
|
|
dce8d4f871 | ||
|
|
d4186d3bb6 | ||
|
|
2aa36542bb | ||
|
|
f43ddf541f | ||
|
|
5a65b53105 | ||
|
|
edc77ea225 | ||
|
|
6384e8ce32 | ||
|
|
38dbd1b3cc | ||
|
|
454c16b3d3 | ||
|
|
00a0f26b98 | ||
|
|
ea58d52e21 | ||
|
|
25d5da7dce | ||
|
|
150586dd31 | ||
|
|
d3730881a5 | ||
|
|
c798b078b1 | ||
|
|
b128ca702e | ||
|
|
8ee22e3eba | ||
|
|
ea7e429802 | ||
|
|
0274f02756 | ||
|
|
cc252cf1d1 | ||
|
|
987bb13f16 | ||
|
|
0522129bba | ||
|
|
c3b9d85d35 | ||
|
|
f8dddd0c1c | ||
|
|
0a58a3a79d | ||
|
|
f176a505e5 | ||
|
|
d9a2c12d8e | ||
|
|
b94cfc8065 | ||
|
|
1acde54d9c | ||
|
|
7a8ff24066 | ||
|
|
3f3d3da307 | ||
|
|
63e6211217 | ||
|
|
34fa183530 | ||
|
|
4c19dd0f63 | ||
|
|
b49bac6629 | ||
|
|
e3659a5242 | ||
|
|
a848cd4468 | ||
|
|
fc21514504 | ||
|
|
2150d5da44 | ||
|
|
6e05bf55d7 | ||
|
|
54e08dceaf | ||
|
|
03aaf1d07b | ||
|
|
d1e09c473d | ||
|
|
8b2da58755 | ||
|
|
1dbce082f0 | ||
|
|
34e80caf84 | ||
|
|
f2afb02de1 | ||
|
|
44434fc399 | ||
|
|
dce4731b76 | ||
|
|
5686d26453 | ||
|
|
dca07641b7 | ||
|
|
20e6c12b47 | ||
|
|
532bc08d38 | ||
|
|
1cdfb3c1c4 | ||
|
|
fdb5a649c1 | ||
|
|
c837ddb81d | ||
|
|
e0e0ee73bc | ||
|
|
ff196943d9 | ||
|
|
2751a07021 | ||
|
|
9191a306d7 | ||
|
|
5d76b535c3 | ||
|
|
ea2abbb481 | ||
|
|
26bc6ec90f | ||
|
|
2ce90b5772 | ||
|
|
9a45055e96 | ||
|
|
1de867a224 | ||
|
|
1f04451105 | ||
|
|
e17ae8ac7a | ||
|
|
83340abddf | ||
|
|
66631cbade | ||
|
|
b831b8687b | ||
|
|
db68c2e35d | ||
|
|
7acd90d24f | ||
|
|
d4c125254f | ||
|
|
ef05010595 | ||
|
|
a9ea50e793 | ||
|
|
e55e3a2298 | ||
|
|
b8b674ce92 | ||
|
|
994904e730 | ||
|
|
da7401aa88 | ||
|
|
b4def681ce | ||
|
|
0d5495baa5 | ||
|
|
19c2edeb2d | ||
|
|
585e4ce4dd | ||
|
|
eb911c6667 |
No files matched your search
@@ -1,124 +0,0 @@
|
|||||||
name: Desktop beta
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: 'dev'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: desktop-beta-${{ github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- platform: macos-latest
|
|
||||||
rust_targets: aarch64-apple-darwin,x86_64-apple-darwin,wasm32-unknown-unknown
|
|
||||||
args: --target universal-apple-darwin
|
|
||||||
bundles: target/universal-apple-darwin/release/bundle/dmg/*.dmg
|
|
||||||
# the oldest supported Ubuntu, so that the AppImage runs on older systems too
|
|
||||||
- platform: ubuntu-22.04
|
|
||||||
rust_targets: wasm32-unknown-unknown
|
|
||||||
args: ''
|
|
||||||
bundles: |
|
|
||||||
target/release/bundle/deb/*.deb
|
|
||||||
target/release/bundle/rpm/*.rpm
|
|
||||||
target/release/bundle/appimage/*.AppImage
|
|
||||||
- platform: windows-latest
|
|
||||||
rust_targets: wasm32-unknown-unknown
|
|
||||||
args: ''
|
|
||||||
bundles: |
|
|
||||||
target/release/bundle/msi/*.msi
|
|
||||||
target/release/bundle/nsis/*.exe
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.platform }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v5
|
|
||||||
|
|
||||||
- name: Install Linux dependencies
|
|
||||||
if: runner.os == 'Linux'
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
|
|
||||||
|
|
||||||
- name: Install Node.js
|
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version: 24
|
|
||||||
cache: npm
|
|
||||||
cache-dependency-path: website/package-lock.json
|
|
||||||
|
|
||||||
- name: Install Rust
|
|
||||||
uses: dtolnay/rust-toolchain@stable
|
|
||||||
with:
|
|
||||||
targets: ${{ matrix.rust_targets }}
|
|
||||||
|
|
||||||
- name: Cache Rust build
|
|
||||||
uses: Swatinem/rust-cache@v2
|
|
||||||
|
|
||||||
- name: Install wasm-pack
|
|
||||||
uses: taiki-e/install-action@v2
|
|
||||||
with:
|
|
||||||
tool: wasm-pack
|
|
||||||
|
|
||||||
# the desktop app does not use it, but the website depends on its package
|
|
||||||
- name: Build wasm
|
|
||||||
run: wasm-pack build --target bundler
|
|
||||||
working-directory: wasm
|
|
||||||
|
|
||||||
- name: Install dependencies for website
|
|
||||||
run: npm install --prefix website
|
|
||||||
|
|
||||||
# the key would be readable in the app: it is left empty, so only the MapTiler layer fails
|
|
||||||
- name: Create env file
|
|
||||||
run: echo "PUBLIC_MAPTILER_KEY=" >> website/.env
|
|
||||||
|
|
||||||
- name: Build app
|
|
||||||
run: npx --yes @tauri-apps/cli@2 build ${{ matrix.args }}
|
|
||||||
working-directory: tauri
|
|
||||||
|
|
||||||
# after the build, which gives the app the website it embeds
|
|
||||||
- name: Test engine and app
|
|
||||||
run: cargo test -p gpx-engine -p gpx-studio-desktop
|
|
||||||
|
|
||||||
- name: Upload bundles
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: bundles-${{ matrix.platform }}
|
|
||||||
path: ${{ matrix.bundles }}
|
|
||||||
if-no-files-found: error
|
|
||||||
|
|
||||||
# replaces the beta release only once every platform is built
|
|
||||||
release:
|
|
||||||
needs: build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
GH_REPO: ${{ github.repository }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Download bundles
|
|
||||||
uses: actions/download-artifact@v5
|
|
||||||
with:
|
|
||||||
pattern: bundles-*
|
|
||||||
path: bundles
|
|
||||||
merge-multiple: true
|
|
||||||
|
|
||||||
- name: Publish beta release
|
|
||||||
# the bundles of a platform are in a folder per format (deb, msi…)
|
|
||||||
run: |
|
|
||||||
mapfile -t files < <(find bundles -type f)
|
|
||||||
gh release delete desktop-beta --cleanup-tag --yes || true
|
|
||||||
gh release create desktop-beta "${files[@]}" \
|
|
||||||
--prerelease \
|
|
||||||
--target ${{ github.sha }} \
|
|
||||||
--title "Desktop beta" \
|
|
||||||
--notes "Beta of the desktop app, built from ${{ github.sha }} on the dev branch. The builds are not signed yet: macOS and Windows will warn before opening them."
|
|
||||||
@@ -7,15 +7,6 @@ edition = "2024"
|
|||||||
[lib]
|
[lib]
|
||||||
name = "gpx_studio_desktop_lib"
|
name = "gpx_studio_desktop_lib"
|
||||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||||
# the tests are in `tests/app`: on Windows, a test binary of the library or of the app could not
|
|
||||||
# start without the manifest, which `build.rs` only gives to the binaries of `tests`
|
|
||||||
test = false
|
|
||||||
doctest = false
|
|
||||||
|
|
||||||
[[bin]]
|
|
||||||
name = "gpx-studio-desktop"
|
|
||||||
path = "src/main.rs"
|
|
||||||
test = false
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tauri = { version = "2", features = ["test"] }
|
tauri = { version = "2", features = ["test"] }
|
||||||
|
|||||||
@@ -1,20 +1,3 @@
|
|||||||
fn main() {
|
fn main() {
|
||||||
// On Windows, the dialogs need Common Controls v6, which a binary only gets with a manifest that
|
|
||||||
// asks for it: tauri-build gives one to the app, but not to the test binaries, which would stop
|
|
||||||
// with STATUS_ENTRYPOINT_NOT_FOUND before running any test. This gives them the same manifest
|
|
||||||
// (`-tests` only reaches the binaries of `tests`, hence the tests are there).
|
|
||||||
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows")
|
|
||||||
&& std::env::var("CARGO_CFG_TARGET_ENV").as_deref() == Ok("msvc")
|
|
||||||
{
|
|
||||||
let manifest = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
|
|
||||||
.join("tests")
|
|
||||||
.join("windows-test.manifest");
|
|
||||||
println!("cargo:rerun-if-changed={}", manifest.display());
|
|
||||||
println!("cargo:rustc-link-arg-tests=/MANIFEST:EMBED");
|
|
||||||
println!(
|
|
||||||
"cargo:rustc-link-arg-tests=/MANIFESTINPUT:{}",
|
|
||||||
manifest.display()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
tauri_build::build()
|
tauri_build::build()
|
||||||
}
|
}
|
||||||
+9
-6
@@ -3,20 +3,20 @@
|
|||||||
|
|
||||||
mod bytes;
|
mod bytes;
|
||||||
mod commands;
|
mod commands;
|
||||||
pub mod state;
|
mod state;
|
||||||
pub mod store;
|
mod store;
|
||||||
pub mod workspace;
|
mod workspace;
|
||||||
|
|
||||||
use commands::*;
|
use commands::*;
|
||||||
use tauri::{Emitter, Manager};
|
use tauri::{Emitter, Manager};
|
||||||
|
|
||||||
/// The engine of the app: each file has its own history, so that undoing only concerns the
|
/// The engine of the app: each file has its own history, so that undoing only concerns the
|
||||||
/// selected files, and opening or closing a file is not something to undo.
|
/// selected files, and opening or closing a file is not something to undo.
|
||||||
pub type Engine = gpx_engine::Engine<gpx_engine::PerFileHistory>;
|
pub(crate) type Engine = gpx_engine::Engine<gpx_engine::PerFileHistory>;
|
||||||
|
|
||||||
/// The GPX files among what the system gave to the app (the arguments of the command line, when a
|
/// The GPX files among what the system gave to the app (the arguments of the command line, when a
|
||||||
/// file is opened with it).
|
/// file is opened with it).
|
||||||
pub fn gpx_paths(arguments: impl IntoIterator<Item = String>) -> Vec<std::path::PathBuf> {
|
fn gpx_paths(arguments: impl IntoIterator<Item = String>) -> Vec<std::path::PathBuf> {
|
||||||
arguments
|
arguments
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(std::path::PathBuf::from)
|
.map(std::path::PathBuf::from)
|
||||||
@@ -108,7 +108,7 @@ fn menu<R: tauri::Runtime>(app: &tauri::AppHandle<R>) -> tauri::Result<tauri::me
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Gives the builder the commands that reach the engine (which it has to be given as `AppState`).
|
/// Gives the builder the commands that reach the engine (which it has to be given as `AppState`).
|
||||||
pub fn register_commands<R: tauri::Runtime>(builder: tauri::Builder<R>) -> tauri::Builder<R> {
|
fn register_commands<R: tauri::Runtime>(builder: tauri::Builder<R>) -> tauri::Builder<R> {
|
||||||
builder.invoke_handler(tauri::generate_handler![
|
builder.invoke_handler(tauri::generate_handler![
|
||||||
// selection
|
// selection
|
||||||
selection::select,
|
selection::select,
|
||||||
@@ -234,3 +234,6 @@ pub fn register_commands<R: tauri::Runtime>(builder: tauri::Builder<R>) -> tauri
|
|||||||
system::reveal_path,
|
system::reveal_path,
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests;
|
||||||
@@ -280,6 +280,13 @@ impl AppState {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// An engine that keeps its data in a directory of its own, and has nobody to tell.
|
||||||
|
#[cfg(test)]
|
||||||
|
pub fn temporary() -> Self {
|
||||||
|
let directory = std::env::temp_dir().join(format!("gpx-studio-{}", uuid::Uuid::new_v4()));
|
||||||
|
Self::open(directory, Arc::new(|_, _| {})).expect("the storage can be opened")
|
||||||
|
}
|
||||||
|
|
||||||
/// Opens files that the system gave to the app, see `Core::open_external`.
|
/// Opens files that the system gave to the app, see `Core::open_external`.
|
||||||
pub fn open_external(&self, paths: Vec<PathBuf>) {
|
pub fn open_external(&self, paths: Vec<PathBuf>) {
|
||||||
self.core(move |core| core.open_external(&paths));
|
self.core(move |core| core.open_external(&paths));
|
||||||
|
|||||||
@@ -217,3 +217,69 @@ impl Storage for FileStorage {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use crate::Engine;
|
||||||
|
use gpx_engine::{Action, Command, Load, LoadFiles, Persister};
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
fn directory() -> PathBuf {
|
||||||
|
std::env::temp_dir().join(format!("gpx-studio-store-{}", Uuid::new_v4()))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn engine_with_a_file() -> Engine {
|
||||||
|
let mut engine = Engine::default();
|
||||||
|
let data = std::fs::read("../gpx-rs/data/simple.gpx").unwrap();
|
||||||
|
engine
|
||||||
|
.execute(Action::Edit(Command::LoadFiles(LoadFiles {
|
||||||
|
files: vec![Load {
|
||||||
|
data: &data,
|
||||||
|
name: "simple",
|
||||||
|
}],
|
||||||
|
})))
|
||||||
|
.unwrap();
|
||||||
|
engine
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn keeps_the_files_and_the_settings_between_sessions() {
|
||||||
|
let root = directory();
|
||||||
|
let engine = engine_with_a_file();
|
||||||
|
let order = engine.order().to_vec();
|
||||||
|
|
||||||
|
let storage = FileStorage::open(&root).unwrap();
|
||||||
|
pollster::block_on(Persister::default().save(&storage, engine.snapshot())).unwrap();
|
||||||
|
pollster::block_on(storage.put_setting("units", "\"metric\"")).unwrap();
|
||||||
|
|
||||||
|
// another session
|
||||||
|
let storage = FileStorage::open(&root).unwrap();
|
||||||
|
let restored = pollster::block_on(Persister::default().restore(&storage)).unwrap();
|
||||||
|
let mut other = Engine::default();
|
||||||
|
other.restore(restored);
|
||||||
|
assert_eq!(other.order(), order);
|
||||||
|
assert_eq!(
|
||||||
|
other.file_statistics(&order[0]).unwrap().total_distance,
|
||||||
|
engine.file_statistics(&order[0]).unwrap().total_distance
|
||||||
|
);
|
||||||
|
assert_eq!(storage.settings()["units"], "\"metric\"");
|
||||||
|
fs::remove_dir_all(root).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn refuses_a_commit_that_is_not_based_on_the_head() {
|
||||||
|
let root = directory();
|
||||||
|
let storage = FileStorage::open(&root).unwrap();
|
||||||
|
let batch = Batch {
|
||||||
|
order: Some(vec![]),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
assert_eq!(pollster::block_on(storage.commit(&batch)), Ok(Revision(1)));
|
||||||
|
assert_eq!(
|
||||||
|
pollster::block_on(storage.commit(&batch)),
|
||||||
|
Err(CommitError::Stale { head: Revision(1) })
|
||||||
|
);
|
||||||
|
fs::remove_dir_all(root).unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,21 +6,12 @@ use tauri::test::{INVOKE_KEY, get_ipc_response, mock_builder, mock_context, noop
|
|||||||
use tauri::webview::InvokeRequest;
|
use tauri::webview::InvokeRequest;
|
||||||
use tauri::{WebviewWindow, ipc::CallbackFn, ipc::InvokeBody, ipc::InvokeResponseBody};
|
use tauri::{WebviewWindow, ipc::CallbackFn, ipc::InvokeBody, ipc::InvokeResponseBody};
|
||||||
|
|
||||||
/// The origin of the pages of the app, the one Tauri allows the commands from: Windows has no
|
|
||||||
/// custom protocols, the pages come from `http://tauri.localhost` there.
|
|
||||||
const ORIGIN: &str = if cfg!(windows) {
|
|
||||||
"http://tauri.localhost"
|
|
||||||
} else {
|
|
||||||
"tauri://localhost"
|
|
||||||
};
|
|
||||||
|
|
||||||
struct App(WebviewWindow<tauri::test::MockRuntime>);
|
struct App(WebviewWindow<tauri::test::MockRuntime>);
|
||||||
|
|
||||||
impl App {
|
impl App {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
let app = gpx_studio_desktop_lib::register_commands(
|
let app =
|
||||||
mock_builder().manage(crate::temporary_state()),
|
crate::register_commands(mock_builder().manage(crate::state::AppState::temporary()))
|
||||||
)
|
|
||||||
.build(mock_context(noop_assets()))
|
.build(mock_context(noop_assets()))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let window = tauri::WebviewWindowBuilder::new(&app, "main", Default::default())
|
let window = tauri::WebviewWindowBuilder::new(&app, "main", Default::default())
|
||||||
@@ -43,7 +34,7 @@ impl App {
|
|||||||
cmd: cmd.into(),
|
cmd: cmd.into(),
|
||||||
callback: CallbackFn(0),
|
callback: CallbackFn(0),
|
||||||
error: CallbackFn(1),
|
error: CallbackFn(1),
|
||||||
url: ORIGIN.parse().unwrap(),
|
url: "tauri://localhost".parse().unwrap(),
|
||||||
body,
|
body,
|
||||||
headers,
|
headers,
|
||||||
invoke_key: INVOKE_KEY.to_string(),
|
invoke_key: INVOKE_KEY.to_string(),
|
||||||
@@ -65,7 +56,7 @@ impl App {
|
|||||||
cmd: cmd.into(),
|
cmd: cmd.into(),
|
||||||
callback: CallbackFn(0),
|
callback: CallbackFn(0),
|
||||||
error: CallbackFn(1),
|
error: CallbackFn(1),
|
||||||
url: ORIGIN.parse().unwrap(),
|
url: "tauri://localhost".parse().unwrap(),
|
||||||
body: InvokeBody::Json(args),
|
body: InvokeBody::Json(args),
|
||||||
headers: Default::default(),
|
headers: Default::default(),
|
||||||
invoke_key: INVOKE_KEY.to_string(),
|
invoke_key: INVOKE_KEY.to_string(),
|
||||||
@@ -320,8 +311,8 @@ fn keeps_settings_for_the_session() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn the_files_are_still_there_in_the_next_session() {
|
fn the_files_are_still_there_in_the_next_session() {
|
||||||
|
use crate::state::AppState;
|
||||||
use gpx_engine::api;
|
use gpx_engine::api;
|
||||||
use gpx_studio_desktop_lib::state::AppState;
|
|
||||||
|
|
||||||
let directory =
|
let directory =
|
||||||
std::env::temp_dir().join(format!("gpx-studio-session-{}", uuid::Uuid::new_v4()));
|
std::env::temp_dir().join(format!("gpx-studio-session-{}", uuid::Uuid::new_v4()));
|
||||||
@@ -356,14 +347,14 @@ fn only_gpx_files_that_exist_are_taken_from_what_the_system_gives() {
|
|||||||
text.to_string_lossy().into_owned(),
|
text.to_string_lossy().into_owned(),
|
||||||
directory.join("missing.gpx").to_string_lossy().into_owned(),
|
directory.join("missing.gpx").to_string_lossy().into_owned(),
|
||||||
];
|
];
|
||||||
assert_eq!(gpx_studio_desktop_lib::gpx_paths(arguments), [track]);
|
assert_eq!(crate::gpx_paths(arguments), [track]);
|
||||||
std::fs::remove_dir_all(directory).unwrap();
|
std::fs::remove_dir_all(directory).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn a_file_opened_with_the_app_is_opened_selected_and_announced() {
|
fn a_file_opened_with_the_app_is_opened_selected_and_announced() {
|
||||||
|
use crate::state::AppState;
|
||||||
use gpx_engine::api;
|
use gpx_engine::api;
|
||||||
use gpx_studio_desktop_lib::state::AppState;
|
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
let directory = std::env::temp_dir().join(format!("gpx-studio-open-{}", uuid::Uuid::new_v4()));
|
let directory = std::env::temp_dir().join(format!("gpx-studio-open-{}", uuid::Uuid::new_v4()));
|
||||||
@@ -450,7 +441,7 @@ fn a_file_outside_the_open_folder_is_read_again_when_the_disk_changes() {
|
|||||||
|
|
||||||
let (events, received) = mpsc::channel();
|
let (events, received) = mpsc::channel();
|
||||||
let directory = std::env::temp_dir().join(format!("gpx-store-{}", uuid::Uuid::new_v4()));
|
let directory = std::env::temp_dir().join(format!("gpx-store-{}", uuid::Uuid::new_v4()));
|
||||||
let state = gpx_studio_desktop_lib::state::AppState::open(
|
let state = crate::state::AppState::open(
|
||||||
directory.clone(),
|
directory.clone(),
|
||||||
std::sync::Arc::new(move |name, _| {
|
std::sync::Arc::new(move |name, _| {
|
||||||
let _ = events.send(name.to_string());
|
let _ = events.send(name.to_string());
|
||||||
@@ -470,8 +461,8 @@ fn a_file_outside_the_open_folder_is_read_again_when_the_disk_changes() {
|
|||||||
});
|
});
|
||||||
let id = uuid::Uuid::parse_str(&id).unwrap();
|
let id = uuid::Uuid::parse_str(&id).unwrap();
|
||||||
// the name comes from the path, which does not change: the content does
|
// the name comes from the path, which does not change: the content does
|
||||||
let signature = |state: &gpx_studio_desktop_lib::state::AppState| {
|
let signature = |state: &crate::state::AppState| {
|
||||||
state.core(move |core| gpx_studio_desktop_lib::workspace::signature(&core.engine, id))
|
state.core(move |core| crate::workspace::signature(&core.engine, id))
|
||||||
};
|
};
|
||||||
let before = signature(&state);
|
let before = signature(&state);
|
||||||
|
|
||||||
@@ -492,7 +483,7 @@ fn a_file_outside_the_open_folder_is_read_again_when_the_disk_changes() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn files_made_from_a_file_of_the_open_folder_are_written_next_to_it_at_once() {
|
fn files_made_from_a_file_of_the_open_folder_are_written_next_to_it_at_once() {
|
||||||
let state = crate::temporary_state();
|
let state = crate::state::AppState::temporary();
|
||||||
let folder = std::env::temp_dir().join(format!("gpx-tests-{}", uuid::Uuid::new_v4()));
|
let folder = std::env::temp_dir().join(format!("gpx-tests-{}", uuid::Uuid::new_v4()));
|
||||||
std::fs::create_dir_all(folder.join("sub")).unwrap();
|
std::fs::create_dir_all(folder.join("sub")).unwrap();
|
||||||
std::fs::copy("../gpx-rs/data/simple.gpx", folder.join("sub/track.gpx")).unwrap();
|
std::fs::copy("../gpx-rs/data/simple.gpx", folder.join("sub/track.gpx")).unwrap();
|
||||||
@@ -525,23 +516,19 @@ fn files_made_from_a_file_of_the_open_folder_are_written_next_to_it_at_once() {
|
|||||||
.collect();
|
.collect();
|
||||||
// the copy is in the subfolder, named after its name (the one in the file, not of the file)
|
// the copy is in the subfolder, named after its name (the one in the file, not of the file)
|
||||||
assert!(
|
assert!(
|
||||||
paths
|
paths.iter().any(|path| path.ends_with("sub/simple.gpx")),
|
||||||
.iter()
|
|
||||||
.any(|path| std::path::Path::new(path).ends_with("sub/simple.gpx")),
|
|
||||||
"{paths:?}"
|
"{paths:?}"
|
||||||
);
|
);
|
||||||
// the new file went where the selected file is
|
// the new file went where the selected file is
|
||||||
assert!(
|
assert!(
|
||||||
paths
|
paths.iter().any(|path| path.ends_with("sub/fresh.gpx")),
|
||||||
.iter()
|
|
||||||
.any(|path| std::path::Path::new(path).ends_with("sub/fresh.gpx")),
|
|
||||||
"{paths:?}"
|
"{paths:?}"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn the_parts_of_a_split_are_numbered_from_one() {
|
fn the_parts_of_a_split_are_numbered_from_one() {
|
||||||
let state = crate::temporary_state();
|
let state = crate::state::AppState::temporary();
|
||||||
let folder = std::env::temp_dir().join(format!("gpx-tests-{}", uuid::Uuid::new_v4()));
|
let folder = std::env::temp_dir().join(format!("gpx-tests-{}", uuid::Uuid::new_v4()));
|
||||||
std::fs::create_dir_all(&folder).unwrap();
|
std::fs::create_dir_all(&folder).unwrap();
|
||||||
std::fs::copy("../gpx-rs/data/simple.gpx", folder.join("track.gpx")).unwrap();
|
std::fs::copy("../gpx-rs/data/simple.gpx", folder.join("track.gpx")).unwrap();
|
||||||
@@ -662,7 +649,7 @@ fn a_file_keeps_its_name_and_its_file_is_renamed_apart() {
|
|||||||
|
|
||||||
// the name of another file is not taken
|
// the name of another file is not taken
|
||||||
let error = app.error("rename_file", json!({ "fileId": id, "name": "taken" }));
|
let error = app.error("rename_file", json!({ "fileId": id, "name": "taken" }));
|
||||||
assert_eq!(error, gpx_studio_desktop_lib::workspace::NAME_TAKEN);
|
assert_eq!(error, crate::workspace::NAME_TAKEN);
|
||||||
assert!(folder.join("moved.gpx").exists());
|
assert!(folder.join("moved.gpx").exists());
|
||||||
|
|
||||||
// a name is one that a file can have
|
// a name is one that a file can have
|
||||||
+812
-2
@@ -148,7 +148,7 @@ pub struct Entry {
|
|||||||
pub is_dir: bool,
|
pub is_dir: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_gpx(path: &Path) -> bool {
|
fn is_gpx(path: &Path) -> bool {
|
||||||
path.extension()
|
path.extension()
|
||||||
.and_then(|extension| extension.to_str())
|
.and_then(|extension| extension.to_str())
|
||||||
.is_some_and(|extension| extension.eq_ignore_ascii_case("gpx"))
|
.is_some_and(|extension| extension.eq_ignore_ascii_case("gpx"))
|
||||||
@@ -156,7 +156,7 @@ pub fn is_gpx(path: &Path) -> bool {
|
|||||||
|
|
||||||
/// Compares names the way people read them: the numbers in them by their value ("track 2" before
|
/// Compares names the way people read them: the numbers in them by their value ("track 2" before
|
||||||
/// "track 10"), the rest regardless of case.
|
/// "track 10"), the rest regardless of case.
|
||||||
pub fn natural_cmp(a: &str, b: &str) -> Ordering {
|
fn natural_cmp(a: &str, b: &str) -> Ordering {
|
||||||
let (mut a, mut b) = (a.chars().peekable(), b.chars().peekable());
|
let (mut a, mut b) = (a.chars().peekable(), b.chars().peekable());
|
||||||
loop {
|
loop {
|
||||||
let order = match (a.peek().copied(), b.peek().copied()) {
|
let order = match (a.peek().copied(), b.peek().copied()) {
|
||||||
@@ -1040,3 +1040,813 @@ impl Workspace {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use gpx_engine::SelectMode;
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
fn gpx(name: &str) -> String {
|
||||||
|
format!(
|
||||||
|
r#"<?xml version="1.0"?><gpx version="1.1" creator="test" xmlns="http://www.topografix.com/GPX/1/1"><metadata><name>{name}</name></metadata><trk><name>{name}</name><trkseg><trkpt lat="50.0" lon="4.0"><ele>10</ele></trkpt><trkpt lat="50.1" lon="4.1"><ele>20</ele></trkpt></trkseg></trk></gpx>"#
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The GPX files of a folder and of the folders in it.
|
||||||
|
pub(super) fn gpx_files(folder: &Path) -> Vec<PathBuf> {
|
||||||
|
let mut found = vec![];
|
||||||
|
for entry in fs::read_dir(folder).unwrap().flatten() {
|
||||||
|
let path = entry.path();
|
||||||
|
if path.is_dir() {
|
||||||
|
found.extend(gpx_files(&path));
|
||||||
|
} else if is_gpx(&path) {
|
||||||
|
found.push(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
found.sort();
|
||||||
|
found
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Fixture {
|
||||||
|
folder: PathBuf,
|
||||||
|
engine: Engine,
|
||||||
|
workspace: Workspace,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Fixture {
|
||||||
|
fn new() -> Self {
|
||||||
|
let folder =
|
||||||
|
canonical(&std::env::temp_dir()).join(format!("gpx-ws-{}", Uuid::new_v4()));
|
||||||
|
fs::create_dir_all(&folder).unwrap();
|
||||||
|
Self {
|
||||||
|
folder,
|
||||||
|
engine: Engine::default(),
|
||||||
|
workspace: Workspace::default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write(&self, name: &str, title: &str) -> PathBuf {
|
||||||
|
let path = self.folder.join(name);
|
||||||
|
fs::write(&path, gpx(title)).unwrap();
|
||||||
|
path
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Opens the folder, and all the files that are in it.
|
||||||
|
fn open_folder(&mut self) {
|
||||||
|
let folder = self.folder.clone();
|
||||||
|
self.workspace.open_folder(&mut self.engine, &folder, false);
|
||||||
|
let files = gpx_files(&folder);
|
||||||
|
self.workspace.open_files(&mut self.engine, &files, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn reconcile(&mut self, changed: Option<&[PathBuf]>) -> Option<api::Outcome> {
|
||||||
|
self.workspace.reconcile(&mut self.engine, changed)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn save(&mut self, ids: &[Uuid]) {
|
||||||
|
self.workspace
|
||||||
|
.save(&mut self.engine, ids, &BTreeMap::new(), None)
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn ids(&self) -> Vec<Uuid> {
|
||||||
|
self.engine.order().iter().map(|id| id.0).collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn id_named(&self, name: &str) -> Uuid {
|
||||||
|
self.ids()
|
||||||
|
.into_iter()
|
||||||
|
.find(|id| self.name(*id) == name)
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn name(&self, id: Uuid) -> String {
|
||||||
|
self.engine
|
||||||
|
.file_structure(&FileId(id))
|
||||||
|
.unwrap()
|
||||||
|
.name
|
||||||
|
.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// What the file holds: the name of its track (its own name is the one of the file).
|
||||||
|
fn content(&self, id: Uuid) -> String {
|
||||||
|
self.engine.file_structure(&FileId(id)).unwrap().tracks[0]
|
||||||
|
.info
|
||||||
|
.name
|
||||||
|
.clone()
|
||||||
|
.unwrap_or_default()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn rename(&mut self, id: Uuid, name: &str) {
|
||||||
|
api::select(&mut self.engine, &[id], SelectMode::Replace);
|
||||||
|
assert!(!api::metadata(&mut self.engine, name, "").has_error());
|
||||||
|
}
|
||||||
|
|
||||||
|
fn status(&self, id: Uuid) -> FileStatus {
|
||||||
|
self.workspace
|
||||||
|
.state(&self.engine)
|
||||||
|
.files
|
||||||
|
.remove(&id.to_string())
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Drop for Fixture {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
let _ = fs::remove_dir_all(&self.folder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn an_opened_file_is_clean_until_it_is_edited_and_clean_again_once_saved() {
|
||||||
|
let mut fx = Fixture::new();
|
||||||
|
let path = fx.write("a.gpx", "a");
|
||||||
|
fx.workspace
|
||||||
|
.open_files(&mut fx.engine, std::slice::from_ref(&path), true);
|
||||||
|
let id = fx.ids()[0];
|
||||||
|
assert!(!fx.workspace.is_dirty(&fx.engine, id));
|
||||||
|
assert_eq!(fx.status(id).path.as_deref(), path.to_str());
|
||||||
|
|
||||||
|
fx.rename(id, "renamed");
|
||||||
|
assert!(fx.workspace.is_dirty(&fx.engine, id));
|
||||||
|
// nothing is written before it is saved
|
||||||
|
assert!(fs::read_to_string(&path).unwrap().contains(">a<"));
|
||||||
|
|
||||||
|
fx.save(&[id]);
|
||||||
|
assert!(!fx.workspace.is_dirty(&fx.engine, id));
|
||||||
|
assert!(fs::read_to_string(&path).unwrap().contains(">renamed<"));
|
||||||
|
|
||||||
|
// going back before the save is an edit again
|
||||||
|
api::select(&mut fx.engine, &[id], SelectMode::Replace);
|
||||||
|
api::undo(&mut fx.engine);
|
||||||
|
assert!(fx.workspace.is_dirty(&fx.engine, id));
|
||||||
|
api::redo(&mut fx.engine);
|
||||||
|
assert!(!fx.workspace.is_dirty(&fx.engine, id));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_file_that_is_not_on_the_disk_is_unsaved_until_it_is_given_a_place() {
|
||||||
|
let mut fx = Fixture::new();
|
||||||
|
api::new_file(&mut fx.engine, "fresh", None, None, None, false);
|
||||||
|
let id = fx.ids()[0];
|
||||||
|
assert!(fx.workspace.is_dirty(&fx.engine, id));
|
||||||
|
assert_eq!(
|
||||||
|
fx.workspace.unlinked(&fx.engine, &[id]),
|
||||||
|
[(id, "fresh".to_string())]
|
||||||
|
);
|
||||||
|
// nowhere to put it without being told
|
||||||
|
fx.save(&[id]);
|
||||||
|
assert!(fx.workspace.is_dirty(&fx.engine, id));
|
||||||
|
|
||||||
|
let path = fx.folder.join("fresh.gpx");
|
||||||
|
let paths = BTreeMap::from([(id, path.clone())]);
|
||||||
|
fx.workspace
|
||||||
|
.save(&mut fx.engine, &[id], &paths, None)
|
||||||
|
.unwrap();
|
||||||
|
assert!(path.exists());
|
||||||
|
assert!(!fx.workspace.is_dirty(&fx.engine, id));
|
||||||
|
assert!(fx.workspace.unlinked(&fx.engine, &[id]).is_empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn several_files_without_a_place_go_in_a_folder_with_names_that_are_free() {
|
||||||
|
let mut fx = Fixture::new();
|
||||||
|
fx.write("fresh.gpx", "already there");
|
||||||
|
api::new_file(&mut fx.engine, "fresh", None, None, None, false);
|
||||||
|
api::new_file(&mut fx.engine, "a/b: c", None, None, None, false);
|
||||||
|
api::new_file(&mut fx.engine, "fresh", None, None, None, false);
|
||||||
|
let ids = fx.ids();
|
||||||
|
let folder = fx.folder.clone();
|
||||||
|
fx.workspace
|
||||||
|
.save(&mut fx.engine, &ids, &BTreeMap::new(), Some(&folder))
|
||||||
|
.unwrap();
|
||||||
|
for name in ["fresh (2).gpx", "fresh (3).gpx", "a_b_ c.gpx"] {
|
||||||
|
assert!(fx.folder.join(name).exists(), "{name}");
|
||||||
|
}
|
||||||
|
assert!(ids.iter().all(|id| !fx.workspace.is_dirty(&fx.engine, *id)));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn what_this_app_writes_is_not_a_change_of_the_disk() {
|
||||||
|
let mut fx = Fixture::new();
|
||||||
|
let path = fx.write("a.gpx", "a");
|
||||||
|
fx.open_folder();
|
||||||
|
let id = fx.ids()[0];
|
||||||
|
api::select(&mut fx.engine, &[id], SelectMode::Replace);
|
||||||
|
assert!(!api::style(&mut fx.engine, Some("#ff0000"), None, None).has_error());
|
||||||
|
fx.save(&[id]);
|
||||||
|
assert!(fx.reconcile(Some(&[path])).is_none());
|
||||||
|
assert!(!fx.status(id).replaced && !fx.status(id).dirty);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn the_folders_of_the_files_outside_the_open_folder_are_watched_too() {
|
||||||
|
let mut fx = Fixture::new();
|
||||||
|
let inside = fx.write("in.gpx", "in");
|
||||||
|
let elsewhere = canonical(&std::env::temp_dir()).join(format!("gpx-ws-{}", Uuid::new_v4()));
|
||||||
|
fs::create_dir_all(&elsewhere).unwrap();
|
||||||
|
let (one, two) = (elsewhere.join("one.gpx"), elsewhere.join("two.gpx"));
|
||||||
|
fs::write(&one, gpx("one")).unwrap();
|
||||||
|
fs::write(&two, gpx("two")).unwrap();
|
||||||
|
let folder = fx.folder.clone();
|
||||||
|
|
||||||
|
// no folder: only the folder of the files
|
||||||
|
fx.workspace.open_files(&mut fx.engine, &[one, two], false);
|
||||||
|
assert_eq!(fx.workspace.watched(), [(elsewhere.clone(), false)]);
|
||||||
|
|
||||||
|
// the open folder as a whole, and the file in it needs nothing more
|
||||||
|
fx.workspace.open_folder(&mut fx.engine, &folder, false);
|
||||||
|
fx.workspace.open_files(&mut fx.engine, &[inside], false);
|
||||||
|
assert_eq!(
|
||||||
|
fx.workspace.watched(),
|
||||||
|
[(folder, true), (elsewhere.clone(), false)]
|
||||||
|
);
|
||||||
|
|
||||||
|
// closing the files stops it
|
||||||
|
let ids = fx.ids();
|
||||||
|
fx.workspace.close_files(&mut fx.engine, &ids, true);
|
||||||
|
assert_eq!(fx.workspace.watched(), [(fx.folder.clone(), true)]);
|
||||||
|
fs::remove_dir_all(elsewhere).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn opening_a_folder_does_not_open_its_files() {
|
||||||
|
let mut fx = Fixture::new();
|
||||||
|
fx.write("a.gpx", "a");
|
||||||
|
let folder = fx.folder.clone();
|
||||||
|
let outcome = fx.workspace.open_folder(&mut fx.engine, &folder, false);
|
||||||
|
assert!(!outcome.changed);
|
||||||
|
assert!(fx.ids().is_empty());
|
||||||
|
assert_eq!(fx.workspace.folder.as_deref(), Some(folder.as_path()));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn folders_are_made_renamed_and_moved_and_the_open_files_follow() {
|
||||||
|
let mut fx = Fixture::new();
|
||||||
|
let a = fx.write("a.gpx", "a");
|
||||||
|
fx.open_folder();
|
||||||
|
let id = fx.ids()[0];
|
||||||
|
let root = fx.folder.clone();
|
||||||
|
let path_of = |fx: &Fixture| PathBuf::from(fx.status(id).path.unwrap());
|
||||||
|
|
||||||
|
let first = fx.workspace.create_folder(&root, "New folder").unwrap();
|
||||||
|
let second = fx.workspace.create_folder(&root, "New folder").unwrap();
|
||||||
|
assert_eq!(first, root.join("New folder"));
|
||||||
|
assert_eq!(second, root.join("New folder 2"));
|
||||||
|
|
||||||
|
fx.workspace.move_paths(&[a], &first).unwrap();
|
||||||
|
assert_eq!(path_of(&fx), first.join("a.gpx"));
|
||||||
|
assert!(first.join("a.gpx").exists() && !fx.status(id).dirty);
|
||||||
|
|
||||||
|
let trips = fx.workspace.rename_path(&first, "Trips").unwrap();
|
||||||
|
assert_eq!(path_of(&fx), root.join("Trips/a.gpx"));
|
||||||
|
// a folder does not go into itself, nor onto something else
|
||||||
|
assert!(
|
||||||
|
fx.workspace
|
||||||
|
.move_paths(std::slice::from_ref(&trips), &trips)
|
||||||
|
.is_err()
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
fx.workspace.rename_path(&trips, "New folder 2"),
|
||||||
|
Err(NAME_TAKEN.to_owned())
|
||||||
|
);
|
||||||
|
fx.workspace.move_paths(&[trips], &second).unwrap();
|
||||||
|
assert_eq!(path_of(&fx), second.join("Trips/a.gpx"));
|
||||||
|
|
||||||
|
// a file keeps its extension
|
||||||
|
let closed = fx.write("c.gpx", "c");
|
||||||
|
assert_eq!(
|
||||||
|
fx.workspace.rename_path(&closed, "d").unwrap(),
|
||||||
|
root.join("d.gpx")
|
||||||
|
);
|
||||||
|
// the open folder and what is not in it are left alone
|
||||||
|
assert!(fx.workspace.rename_path(&root, "x").is_err());
|
||||||
|
let elsewhere = canonical(&std::env::temp_dir());
|
||||||
|
assert!(fx.workspace.rename_path(&elsewhere, "x").is_err());
|
||||||
|
assert!(fx.workspace.create_folder(&elsewhere, "x").is_err());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn deleted_files_are_closed_unless_they_have_edits() {
|
||||||
|
let mut fx = Fixture::new();
|
||||||
|
let a = fx.write("a.gpx", "a");
|
||||||
|
let b = fx.write("b.gpx", "b");
|
||||||
|
fx.open_folder();
|
||||||
|
let (id_a, id_b) = (fx.id_named("a"), fx.id_named("b"));
|
||||||
|
api::select(&mut fx.engine, &[id_b], SelectMode::Replace);
|
||||||
|
assert!(!api::style(&mut fx.engine, Some("#ff0000"), None, None).has_error());
|
||||||
|
|
||||||
|
let outcome = fx
|
||||||
|
.workspace
|
||||||
|
.delete_paths(&mut fx.engine, &[a.clone(), b.clone()], |paths| {
|
||||||
|
paths.iter().for_each(|path| fs::remove_file(path).unwrap());
|
||||||
|
Ok(())
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
assert!(outcome.changed);
|
||||||
|
assert_eq!(fx.ids(), [id_b]);
|
||||||
|
assert!(!fx.ids().contains(&id_a));
|
||||||
|
let status = fx.status(id_b);
|
||||||
|
assert!(status.dirty && status.missing);
|
||||||
|
assert!(!a.exists() && !b.exists());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn the_tree_of_the_folder_shows_folders_first_and_only_gpx_files() {
|
||||||
|
let mut fx = Fixture::new();
|
||||||
|
fx.write("b.gpx", "b");
|
||||||
|
fx.write("A.GPX", "a");
|
||||||
|
fx.write("b 10.gpx", "b 10");
|
||||||
|
fx.write("b 2.gpx", "b 2");
|
||||||
|
fx.write("notes.txt", "not a track");
|
||||||
|
fx.write(".hidden.gpx", "hidden");
|
||||||
|
fs::create_dir(fx.folder.join("zoo")).unwrap();
|
||||||
|
fs::create_dir(fx.folder.join("Alps")).unwrap();
|
||||||
|
fs::create_dir(fx.folder.join(".git")).unwrap();
|
||||||
|
fx.write("zoo/c.gpx", "c");
|
||||||
|
let folder = fx.folder.clone();
|
||||||
|
fx.workspace.open_folder(&mut fx.engine, &folder, false);
|
||||||
|
|
||||||
|
let names = |entries: Vec<Entry>| -> Vec<(String, bool)> {
|
||||||
|
entries.into_iter().map(|e| (e.name, e.is_dir)).collect()
|
||||||
|
};
|
||||||
|
assert_eq!(
|
||||||
|
names(fx.workspace.list_folder(&folder).unwrap()),
|
||||||
|
[
|
||||||
|
("Alps".to_string(), true),
|
||||||
|
("zoo".to_string(), true),
|
||||||
|
("A.GPX".to_string(), false),
|
||||||
|
("b.gpx".to_string(), false),
|
||||||
|
("b 2.gpx".to_string(), false),
|
||||||
|
("b 10.gpx".to_string(), false),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
names(fx.workspace.list_folder(&folder.join("zoo")).unwrap()),
|
||||||
|
[("c.gpx".to_string(), false)]
|
||||||
|
);
|
||||||
|
// only what is in the open folder can be listed
|
||||||
|
let elsewhere = canonical(&std::env::temp_dir());
|
||||||
|
assert!(fx.workspace.list_folder(&elsewhere).is_err());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn names_are_sorted_by_the_numbers_they_hold() {
|
||||||
|
let mut names = vec![
|
||||||
|
"track 10",
|
||||||
|
"track 2",
|
||||||
|
"Track 1",
|
||||||
|
"track",
|
||||||
|
"track 02b",
|
||||||
|
"track 2a",
|
||||||
|
"b",
|
||||||
|
"A",
|
||||||
|
];
|
||||||
|
names.sort_by(|a, b| natural_cmp(a, b).then_with(|| a.cmp(b)));
|
||||||
|
assert_eq!(
|
||||||
|
names,
|
||||||
|
[
|
||||||
|
"A",
|
||||||
|
"b",
|
||||||
|
"track",
|
||||||
|
"Track 1",
|
||||||
|
"track 2",
|
||||||
|
"track 2a",
|
||||||
|
"track 02b",
|
||||||
|
"track 10",
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_file_without_edits_is_read_again_when_the_disk_changes() {
|
||||||
|
let mut fx = Fixture::new();
|
||||||
|
let a = fx.write("a.gpx", "a");
|
||||||
|
fx.open_folder();
|
||||||
|
let id = fx.ids()[0];
|
||||||
|
|
||||||
|
fx.write("a.gpx", "theirs");
|
||||||
|
let outcome = fx.reconcile(Some(std::slice::from_ref(&a))).unwrap();
|
||||||
|
assert!(outcome.changed);
|
||||||
|
// the same file, now the one on the disk
|
||||||
|
assert_eq!(fx.ids(), [id]);
|
||||||
|
assert_eq!(fx.content(id), "theirs");
|
||||||
|
let status = fx.status(id);
|
||||||
|
assert!(!status.dirty && !status.replaced);
|
||||||
|
// looking again changes nothing
|
||||||
|
assert!(fx.reconcile(Some(std::slice::from_ref(&a))).is_none());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_file_with_edits_is_flagged_when_the_disk_changes_and_not_read_again() {
|
||||||
|
let mut fx = Fixture::new();
|
||||||
|
let a = fx.write("a.gpx", "a");
|
||||||
|
fx.open_folder();
|
||||||
|
let id = fx.ids()[0];
|
||||||
|
fx.rename(id, "mine");
|
||||||
|
|
||||||
|
fx.write("a.gpx", "theirs");
|
||||||
|
let outcome = fx.reconcile(Some(std::slice::from_ref(&a))).unwrap();
|
||||||
|
assert!(!outcome.changed);
|
||||||
|
assert_eq!(fx.name(id), "mine");
|
||||||
|
let status = fx.status(id);
|
||||||
|
assert!(status.dirty && status.replaced && !status.missing);
|
||||||
|
// looking again changes nothing
|
||||||
|
assert!(fx.reconcile(Some(std::slice::from_ref(&a))).is_none());
|
||||||
|
|
||||||
|
// the disk goes back to what was read: only the edits are left
|
||||||
|
fx.write("a.gpx", "a");
|
||||||
|
assert!(fx.reconcile(Some(std::slice::from_ref(&a))).is_some());
|
||||||
|
let status = fx.status(id);
|
||||||
|
assert!(status.dirty && !status.replaced);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn the_user_can_take_the_disk_instead_of_the_edits() {
|
||||||
|
let mut fx = Fixture::new();
|
||||||
|
fx.write("a.gpx", "a");
|
||||||
|
fx.open_folder();
|
||||||
|
let id = fx.ids()[0];
|
||||||
|
fx.rename(id, "mine");
|
||||||
|
fx.write("a.gpx", "theirs");
|
||||||
|
fx.reconcile(None);
|
||||||
|
assert!(fx.status(id).replaced);
|
||||||
|
|
||||||
|
fx.workspace.reload(&mut fx.engine, &[id]).unwrap();
|
||||||
|
assert_eq!(fx.content(id), "theirs");
|
||||||
|
let status = fx.status(id);
|
||||||
|
assert!(!status.dirty && !status.replaced);
|
||||||
|
// and it is one undo step
|
||||||
|
api::select(&mut fx.engine, &[id], SelectMode::Replace);
|
||||||
|
api::undo(&mut fx.engine);
|
||||||
|
assert_eq!(fx.content(id), "mine");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn saving_overwrites_what_replaced_the_file() {
|
||||||
|
let mut fx = Fixture::new();
|
||||||
|
let a = fx.write("a.gpx", "a");
|
||||||
|
fx.open_folder();
|
||||||
|
let id = fx.ids()[0];
|
||||||
|
fx.rename(id, "mine");
|
||||||
|
fx.write("a.gpx", "theirs");
|
||||||
|
fx.reconcile(None);
|
||||||
|
assert!(fx.status(id).replaced);
|
||||||
|
|
||||||
|
fx.save(&[id]);
|
||||||
|
assert!(fs::read_to_string(a).unwrap().contains(">mine<"));
|
||||||
|
assert!(!fx.status(id).replaced && !fx.status(id).dirty);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_file_that_is_gone_from_the_disk_stays_open_and_dirty_until_it_is_saved_again() {
|
||||||
|
let mut fx = Fixture::new();
|
||||||
|
let a = fx.write("a.gpx", "a");
|
||||||
|
fx.open_folder();
|
||||||
|
let id = fx.ids()[0];
|
||||||
|
|
||||||
|
fs::remove_file(&a).unwrap();
|
||||||
|
assert!(fx.reconcile(Some(std::slice::from_ref(&a))).is_some());
|
||||||
|
assert_eq!(fx.ids(), [id]);
|
||||||
|
let status = fx.status(id);
|
||||||
|
assert!(status.dirty && status.missing && status.path.is_some());
|
||||||
|
|
||||||
|
// saving puts it back
|
||||||
|
fx.save(&[id]);
|
||||||
|
assert!(a.exists());
|
||||||
|
let status = fx.status(id);
|
||||||
|
assert!(!status.dirty && !status.missing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_file_that_comes_back_different_is_read_again() {
|
||||||
|
let mut fx = Fixture::new();
|
||||||
|
let a = fx.write("a.gpx", "a");
|
||||||
|
fx.open_folder();
|
||||||
|
let id = fx.ids()[0];
|
||||||
|
fs::remove_file(&a).unwrap();
|
||||||
|
fx.reconcile(None);
|
||||||
|
assert!(fx.status(id).missing);
|
||||||
|
|
||||||
|
fx.write("a.gpx", "back");
|
||||||
|
fx.reconcile(None);
|
||||||
|
assert_eq!(fx.content(id), "back");
|
||||||
|
let status = fx.status(id);
|
||||||
|
assert!(!status.dirty && !status.missing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn what_changed_while_the_app_was_closed_is_found_when_it_starts() {
|
||||||
|
let mut fx = Fixture::new();
|
||||||
|
let a = fx.write("a.gpx", "a");
|
||||||
|
fx.open_folder();
|
||||||
|
let id = fx.ids()[0];
|
||||||
|
fx.write("a.gpx", "changed");
|
||||||
|
assert!(fx.reconcile(None).is_some());
|
||||||
|
assert_eq!(fx.content(id), "changed");
|
||||||
|
fs::remove_file(a).unwrap();
|
||||||
|
assert!(fx.reconcile(None).is_some());
|
||||||
|
assert!(fx.status(id).missing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn new_files_made_from_a_file_of_the_folder_are_saved_next_to_it() {
|
||||||
|
let mut fx = Fixture::new();
|
||||||
|
fs::create_dir(fx.folder.join("sub")).unwrap();
|
||||||
|
fx.write("sub/b.gpx", "b");
|
||||||
|
fx.write("a.gpx", "a");
|
||||||
|
fx.open_folder();
|
||||||
|
let b = fx.id_named("b");
|
||||||
|
let sub = fx.folder.join("sub");
|
||||||
|
assert_eq!(fx.workspace.source_dir(&[b]), Some(canonical(&sub)));
|
||||||
|
|
||||||
|
let before = fx.ids();
|
||||||
|
api::select(&mut fx.engine, &[b], SelectMode::Replace);
|
||||||
|
let outcome = api::duplicate(&mut fx.engine);
|
||||||
|
let copy = fx
|
||||||
|
.ids()
|
||||||
|
.into_iter()
|
||||||
|
.find(|id| !before.contains(id))
|
||||||
|
.unwrap();
|
||||||
|
fx.workspace.inherit(outcome.added(), &canonical(&sub));
|
||||||
|
assert_eq!(fx.status(copy).folder.as_deref(), canonical(&sub).to_str());
|
||||||
|
assert!(fx.status(copy).path.is_none() && fx.status(copy).dirty);
|
||||||
|
// nobody needs to be asked where it goes
|
||||||
|
assert!(fx.workspace.unlinked(&fx.engine, &[copy]).is_empty());
|
||||||
|
|
||||||
|
fx.save(&[copy]);
|
||||||
|
assert!(sub.join("b (2).gpx").exists());
|
||||||
|
let status = fx.status(copy);
|
||||||
|
assert!(!status.dirty && status.folder.is_none());
|
||||||
|
assert_eq!(
|
||||||
|
status.path.as_deref(),
|
||||||
|
canonical(&sub.join("b (2).gpx")).to_str()
|
||||||
|
);
|
||||||
|
// the copy of the copy is next to it as well
|
||||||
|
assert_eq!(fx.workspace.source_dir(&[copy]), Some(canonical(&sub)));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_file_outside_the_open_folder_hands_nothing_down() {
|
||||||
|
let mut fx = Fixture::new();
|
||||||
|
let elsewhere = canonical(&std::env::temp_dir()).join(format!("gpx-ws-{}", Uuid::new_v4()));
|
||||||
|
fs::create_dir_all(&elsewhere).unwrap();
|
||||||
|
let outside = elsewhere.join("o.gpx");
|
||||||
|
fs::write(&outside, gpx("o")).unwrap();
|
||||||
|
let folder = fx.folder.clone();
|
||||||
|
fx.workspace.open_folder(&mut fx.engine, &folder, false);
|
||||||
|
fx.workspace
|
||||||
|
.open_files(&mut fx.engine, std::slice::from_ref(&outside), true);
|
||||||
|
let id = fx.ids()[0];
|
||||||
|
assert_eq!(fx.workspace.source_dir(&[id]), None);
|
||||||
|
// a new file with no source is not linked to a folder by `source_dir`: the caller falls back
|
||||||
|
fs::remove_dir_all(elsewhere).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn closing_files_asks_what_to_do_with_the_unsaved_ones() {
|
||||||
|
let mut fx = Fixture::new();
|
||||||
|
fx.write("a.gpx", "a");
|
||||||
|
fx.write("b.gpx", "b");
|
||||||
|
fx.open_folder();
|
||||||
|
let (a, b) = (fx.id_named("a"), fx.id_named("b"));
|
||||||
|
fx.rename(a, "edited");
|
||||||
|
assert_eq!(fx.workspace.unsaved(&fx.engine, &[a, b]), [a]);
|
||||||
|
|
||||||
|
// without a choice what has edits stays
|
||||||
|
let outcome = fx.workspace.close_files(&mut fx.engine, &[a, b], false);
|
||||||
|
assert!(outcome.changed);
|
||||||
|
assert_eq!(fx.ids(), [a]);
|
||||||
|
|
||||||
|
// saved first
|
||||||
|
fx.save(&[a]);
|
||||||
|
fx.workspace.close_files(&mut fx.engine, &[a], false);
|
||||||
|
assert!(fx.ids().is_empty());
|
||||||
|
assert!(
|
||||||
|
fs::read_to_string(fx.folder.join("a.gpx"))
|
||||||
|
.unwrap()
|
||||||
|
.contains("edited")
|
||||||
|
);
|
||||||
|
assert!(fx.workspace.links.is_empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn closing_files_can_discard_their_edits() {
|
||||||
|
let mut fx = Fixture::new();
|
||||||
|
fx.write("a.gpx", "a");
|
||||||
|
fx.open_folder();
|
||||||
|
let a = fx.ids()[0];
|
||||||
|
fx.rename(a, "edited");
|
||||||
|
api::new_file(&mut fx.engine, "fresh", None, None, None, false);
|
||||||
|
let fresh = fx.id_named("fresh");
|
||||||
|
fx.workspace.close_files(&mut fx.engine, &[a, fresh], true);
|
||||||
|
assert!(fx.ids().is_empty());
|
||||||
|
assert!(
|
||||||
|
fs::read_to_string(fx.folder.join("a.gpx"))
|
||||||
|
.unwrap()
|
||||||
|
.contains(">a<")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn closing_the_folder_closes_every_file() {
|
||||||
|
let mut fx = Fixture::new();
|
||||||
|
fx.write("a.gpx", "a");
|
||||||
|
fx.open_folder();
|
||||||
|
api::new_file(&mut fx.engine, "fresh", None, None, None, false);
|
||||||
|
assert_eq!(fx.ids().len(), 2);
|
||||||
|
|
||||||
|
// the new file has nowhere to go: it has to be discarded
|
||||||
|
let outcome = fx.workspace.close_folder(&mut fx.engine, false);
|
||||||
|
assert!(outcome.changed);
|
||||||
|
assert_eq!(fx.ids().len(), 1);
|
||||||
|
assert!(fx.workspace.folder.is_none());
|
||||||
|
|
||||||
|
let outcome = fx.workspace.close_folder(&mut fx.engine, true);
|
||||||
|
assert!(outcome.changed);
|
||||||
|
assert!(fx.ids().is_empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn opening_another_folder_closes_the_first_with_all_its_files() {
|
||||||
|
let mut fx = Fixture::new();
|
||||||
|
fx.write("a.gpx", "a");
|
||||||
|
fx.open_folder();
|
||||||
|
let a = fx.ids()[0];
|
||||||
|
fx.rename(a, "edited");
|
||||||
|
let other = canonical(&std::env::temp_dir()).join(format!("gpx-ws-{}", Uuid::new_v4()));
|
||||||
|
fs::create_dir_all(&other).unwrap();
|
||||||
|
|
||||||
|
// the edits stay, nothing is lost without a choice
|
||||||
|
fx.workspace.open_folder(&mut fx.engine, &other, false);
|
||||||
|
assert_eq!(fx.ids(), [a]);
|
||||||
|
assert_eq!(fx.workspace.folder.as_deref(), Some(other.as_path()));
|
||||||
|
|
||||||
|
let first = fx.folder.clone();
|
||||||
|
fx.workspace.open_folder(&mut fx.engine, &first, true);
|
||||||
|
assert!(fx.ids().is_empty());
|
||||||
|
assert!(
|
||||||
|
fs::read_to_string(fx.folder.join("a.gpx"))
|
||||||
|
.unwrap()
|
||||||
|
.contains(">a<")
|
||||||
|
);
|
||||||
|
fs::remove_dir_all(other).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn opening_the_same_folder_again_changes_nothing() {
|
||||||
|
let mut fx = Fixture::new();
|
||||||
|
fx.write("a.gpx", "a");
|
||||||
|
fx.open_folder();
|
||||||
|
let folder = fx.folder.clone();
|
||||||
|
let outcome = fx.workspace.open_folder(&mut fx.engine, &folder, true);
|
||||||
|
assert!(!outcome.changed);
|
||||||
|
assert_eq!(fx.ids().len(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_failed_save_stops_at_the_file_and_leaves_it_dirty() {
|
||||||
|
let mut fx = Fixture::new();
|
||||||
|
fx.write("a.gpx", "a");
|
||||||
|
fx.open_folder();
|
||||||
|
let id = fx.ids()[0];
|
||||||
|
fx.rename(id, "edited");
|
||||||
|
// the place of the file is taken by a folder
|
||||||
|
fs::remove_file(fx.folder.join("a.gpx")).unwrap();
|
||||||
|
fs::create_dir(fx.folder.join("a.gpx")).unwrap();
|
||||||
|
let result = fx
|
||||||
|
.workspace
|
||||||
|
.save(&mut fx.engine, &[id], &BTreeMap::new(), None);
|
||||||
|
assert!(result.is_err());
|
||||||
|
assert!(fx.workspace.is_dirty(&fx.engine, id));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn saving_as_gives_the_file_another_place() {
|
||||||
|
let mut fx = Fixture::new();
|
||||||
|
let a = fx.write("a.gpx", "a");
|
||||||
|
fx.write("b.gpx", "b");
|
||||||
|
fx.open_folder();
|
||||||
|
let id = fx.id_named("a");
|
||||||
|
let other = fx.id_named("b");
|
||||||
|
fx.rename(id, "edited");
|
||||||
|
|
||||||
|
let target = fx.folder.join("copy.gpx");
|
||||||
|
fx.workspace.save_as(&mut fx.engine, id, &target).unwrap();
|
||||||
|
assert!(fs::read_to_string(&target).unwrap().contains("edited"));
|
||||||
|
assert!(fs::read_to_string(a).unwrap().contains(">a<"));
|
||||||
|
let status = fx.status(id);
|
||||||
|
assert!(!status.dirty);
|
||||||
|
assert_eq!(status.path.as_deref(), canonical(&target).to_str());
|
||||||
|
|
||||||
|
// the place of another open file is not available
|
||||||
|
let taken = fx.folder.join("b.gpx");
|
||||||
|
assert!(fx.workspace.save_as(&mut fx.engine, id, &taken).is_err());
|
||||||
|
assert!(!fx.workspace.is_dirty(&fx.engine, other));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod restart_tests {
|
||||||
|
use gpx_engine::Persister;
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
use crate::store::FileStorage;
|
||||||
|
|
||||||
|
/// What the app does when it starts again: the engine and the links are read from what was
|
||||||
|
/// kept.
|
||||||
|
fn restart(engine: &Engine, workspace: &Workspace, root: &Path) -> (Engine, Workspace) {
|
||||||
|
let storage = FileStorage::open(root).unwrap();
|
||||||
|
pollster::block_on(Persister::default().save(&storage, engine.snapshot())).unwrap();
|
||||||
|
let mut restarted = Engine::default();
|
||||||
|
let restored = pollster::block_on(Persister::default().restore(&storage)).unwrap();
|
||||||
|
restarted.restore(restored);
|
||||||
|
let links = serde_json::to_string(workspace).unwrap();
|
||||||
|
(restarted, serde_json::from_str(&links).unwrap())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn setup() -> (PathBuf, Engine, Workspace, Vec<Uuid>) {
|
||||||
|
let root = std::env::temp_dir().join(format!("gpx-restart-{}", Uuid::new_v4()));
|
||||||
|
let folder = root.join("tracks");
|
||||||
|
fs::create_dir_all(&folder).unwrap();
|
||||||
|
for name in ["with_tracks", "with_time", "with_waypoint"] {
|
||||||
|
let _ = fs::copy(
|
||||||
|
format!("../gpx-rs/data/{name}.gpx"),
|
||||||
|
folder.join(format!("{name}.gpx")),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
let mut engine = Engine::default();
|
||||||
|
let mut workspace = Workspace::default();
|
||||||
|
workspace.open_folder(&mut engine, &folder, false);
|
||||||
|
workspace.open_files(&mut engine, &tests::gpx_files(&folder), false);
|
||||||
|
let ids = engine.order().iter().map(|id| id.0).collect();
|
||||||
|
(root, engine, workspace, ids)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn files_that_were_not_edited_are_not_unsaved_after_a_restart() {
|
||||||
|
let (root, engine, workspace, ids) = setup();
|
||||||
|
assert!(ids.len() >= 2);
|
||||||
|
let (restarted, mut workspace) = restart(&engine, &workspace, &root.join("store"));
|
||||||
|
// the files are the same, but the engine knows their contents by new identities
|
||||||
|
assert!(ids.iter().any(|id| workspace.is_dirty(&restarted, *id)));
|
||||||
|
workspace.verify(&restarted);
|
||||||
|
assert!(ids.iter().all(|id| !workspace.is_dirty(&restarted, *id)));
|
||||||
|
fs::remove_dir_all(root).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn files_that_were_edited_are_still_unsaved_after_a_restart() {
|
||||||
|
let (root, mut engine, workspace, ids) = setup();
|
||||||
|
api::select(&mut engine, &[ids[0]], gpx_engine::SelectMode::Replace);
|
||||||
|
api::metadata(&mut engine, "edited", "");
|
||||||
|
assert!(workspace.is_dirty(&engine, ids[0]));
|
||||||
|
let (restarted, mut workspace) = restart(&engine, &workspace, &root.join("store"));
|
||||||
|
workspace.verify(&restarted);
|
||||||
|
assert!(workspace.is_dirty(&restarted, ids[0]));
|
||||||
|
assert!(
|
||||||
|
ids[1..]
|
||||||
|
.iter()
|
||||||
|
.all(|id| !workspace.is_dirty(&restarted, *id))
|
||||||
|
);
|
||||||
|
fs::remove_dir_all(root).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn links_made_before_the_content_was_kept_are_checked_against_the_disk() {
|
||||||
|
let (root, mut engine, mut workspace, ids) = setup();
|
||||||
|
api::select(&mut engine, &[ids[0]], gpx_engine::SelectMode::Replace);
|
||||||
|
api::metadata(&mut engine, "edited", "");
|
||||||
|
for link in workspace.links.values_mut() {
|
||||||
|
link.export_hash = 0;
|
||||||
|
}
|
||||||
|
let (restarted, mut workspace) = restart(&engine, &workspace, &root.join("store"));
|
||||||
|
workspace.verify(&restarted);
|
||||||
|
assert!(workspace.is_dirty(&restarted, ids[0]));
|
||||||
|
assert!(
|
||||||
|
ids[1..]
|
||||||
|
.iter()
|
||||||
|
.all(|id| !workspace.is_dirty(&restarted, *id))
|
||||||
|
);
|
||||||
|
fs::remove_dir_all(root).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn the_folders_of_new_files_and_the_old_flag_name_survive_a_restart() {
|
||||||
|
let (root, engine, mut workspace, ids) = setup();
|
||||||
|
let folder = workspace.folder.clone().unwrap();
|
||||||
|
let fresh = Uuid::new_v4();
|
||||||
|
workspace.inherit(&[fresh.to_string()], &folder);
|
||||||
|
workspace.links.get_mut(&ids[0]).unwrap().replaced = true;
|
||||||
|
let json = serde_json::to_string(&workspace).unwrap();
|
||||||
|
// links written by the previous version had `conflict`, which is the same thing
|
||||||
|
let json = json.replace("\"replaced\"", "\"conflict\"");
|
||||||
|
assert!(json.contains("\"conflict\":true"));
|
||||||
|
let read: Workspace = serde_json::from_str(&json).unwrap();
|
||||||
|
assert!(read.links[&ids[0]].replaced);
|
||||||
|
assert_eq!(read.dirs.get(&fresh), Some(&folder));
|
||||||
|
let _ = engine;
|
||||||
|
fs::remove_dir_all(root).unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
//! The tests of the desktop app. They are integration tests, in a single binary, rather than unit
|
|
||||||
//! tests: on Windows, only test binaries can be given the manifest that the app needs to start
|
|
||||||
//! (see `build.rs`).
|
|
||||||
|
|
||||||
mod commands;
|
|
||||||
mod store;
|
|
||||||
mod workspace;
|
|
||||||
|
|
||||||
use gpx_studio_desktop_lib::state::AppState;
|
|
||||||
|
|
||||||
/// An engine that keeps its data in a directory of its own, and has nobody to tell.
|
|
||||||
fn temporary_state() -> AppState {
|
|
||||||
let directory = std::env::temp_dir().join(format!("gpx-studio-{}", uuid::Uuid::new_v4()));
|
|
||||||
AppState::open(directory, std::sync::Arc::new(|_, _| {})).expect("the storage can be opened")
|
|
||||||
}
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
//! The storage of the engine on the file system (`store`).
|
|
||||||
|
|
||||||
use std::fs;
|
|
||||||
use std::path::PathBuf;
|
|
||||||
|
|
||||||
use gpx_engine::{
|
|
||||||
Action, Batch, Command, CommitError, Load, LoadFiles, Persister, Revision, Storage,
|
|
||||||
};
|
|
||||||
use gpx_studio_desktop_lib::Engine;
|
|
||||||
use gpx_studio_desktop_lib::store::FileStorage;
|
|
||||||
use uuid::Uuid;
|
|
||||||
|
|
||||||
fn directory() -> PathBuf {
|
|
||||||
std::env::temp_dir().join(format!("gpx-studio-store-{}", Uuid::new_v4()))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn engine_with_a_file() -> Engine {
|
|
||||||
let mut engine = Engine::default();
|
|
||||||
let data = std::fs::read("../gpx-rs/data/simple.gpx").unwrap();
|
|
||||||
engine
|
|
||||||
.execute(Action::Edit(Command::LoadFiles(LoadFiles {
|
|
||||||
files: vec![Load {
|
|
||||||
data: &data,
|
|
||||||
name: "simple",
|
|
||||||
}],
|
|
||||||
})))
|
|
||||||
.unwrap();
|
|
||||||
engine
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn keeps_the_files_and_the_settings_between_sessions() {
|
|
||||||
let root = directory();
|
|
||||||
let engine = engine_with_a_file();
|
|
||||||
let order = engine.order().to_vec();
|
|
||||||
|
|
||||||
let storage = FileStorage::open(&root).unwrap();
|
|
||||||
pollster::block_on(Persister::default().save(&storage, engine.snapshot())).unwrap();
|
|
||||||
pollster::block_on(storage.put_setting("units", "\"metric\"")).unwrap();
|
|
||||||
|
|
||||||
// another session
|
|
||||||
let storage = FileStorage::open(&root).unwrap();
|
|
||||||
let restored = pollster::block_on(Persister::default().restore(&storage)).unwrap();
|
|
||||||
let mut other = Engine::default();
|
|
||||||
other.restore(restored);
|
|
||||||
assert_eq!(other.order(), order);
|
|
||||||
assert_eq!(
|
|
||||||
other.file_statistics(&order[0]).unwrap().total_distance,
|
|
||||||
engine.file_statistics(&order[0]).unwrap().total_distance
|
|
||||||
);
|
|
||||||
assert_eq!(storage.settings()["units"], "\"metric\"");
|
|
||||||
fs::remove_dir_all(root).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn refuses_a_commit_that_is_not_based_on_the_head() {
|
|
||||||
let root = directory();
|
|
||||||
let storage = FileStorage::open(&root).unwrap();
|
|
||||||
let batch = Batch {
|
|
||||||
order: Some(vec![]),
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
assert_eq!(pollster::block_on(storage.commit(&batch)), Ok(Revision(1)));
|
|
||||||
assert_eq!(
|
|
||||||
pollster::block_on(storage.commit(&batch)),
|
|
||||||
Err(CommitError::Stale { head: Revision(1) })
|
|
||||||
);
|
|
||||||
fs::remove_dir_all(root).unwrap();
|
|
||||||
}
|
|
||||||
@@ -1,811 +0,0 @@
|
|||||||
//! The places of the files of the engine on the disk (`workspace`).
|
|
||||||
|
|
||||||
use std::collections::BTreeMap;
|
|
||||||
use std::fs;
|
|
||||||
use std::path::{Path, PathBuf};
|
|
||||||
|
|
||||||
use gpx_engine::{FileId, SelectMode, api};
|
|
||||||
use gpx_studio_desktop_lib::Engine;
|
|
||||||
use gpx_studio_desktop_lib::workspace::*;
|
|
||||||
use uuid::Uuid;
|
|
||||||
|
|
||||||
fn gpx(name: &str) -> String {
|
|
||||||
format!(
|
|
||||||
r#"<?xml version="1.0"?><gpx version="1.1" creator="test" xmlns="http://www.topografix.com/GPX/1/1"><metadata><name>{name}</name></metadata><trk><name>{name}</name><trkseg><trkpt lat="50.0" lon="4.0"><ele>10</ele></trkpt><trkpt lat="50.1" lon="4.1"><ele>20</ele></trkpt></trkseg></trk></gpx>"#
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The GPX files of a folder and of the folders in it.
|
|
||||||
pub fn gpx_files(folder: &Path) -> Vec<PathBuf> {
|
|
||||||
let mut found = vec![];
|
|
||||||
for entry in fs::read_dir(folder).unwrap().flatten() {
|
|
||||||
let path = entry.path();
|
|
||||||
if path.is_dir() {
|
|
||||||
found.extend(gpx_files(&path));
|
|
||||||
} else if is_gpx(&path) {
|
|
||||||
found.push(path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
found.sort();
|
|
||||||
found
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Fixture {
|
|
||||||
folder: PathBuf,
|
|
||||||
engine: Engine,
|
|
||||||
workspace: Workspace,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Fixture {
|
|
||||||
fn new() -> Self {
|
|
||||||
let folder = canonical(&std::env::temp_dir()).join(format!("gpx-ws-{}", Uuid::new_v4()));
|
|
||||||
fs::create_dir_all(&folder).unwrap();
|
|
||||||
Self {
|
|
||||||
folder,
|
|
||||||
engine: Engine::default(),
|
|
||||||
workspace: Workspace::default(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn write(&self, name: &str, title: &str) -> PathBuf {
|
|
||||||
let path = self.folder.join(name);
|
|
||||||
fs::write(&path, gpx(title)).unwrap();
|
|
||||||
path
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Opens the folder, and all the files that are in it.
|
|
||||||
fn open_folder(&mut self) {
|
|
||||||
let folder = self.folder.clone();
|
|
||||||
self.workspace.open_folder(&mut self.engine, &folder, false);
|
|
||||||
let files = gpx_files(&folder);
|
|
||||||
self.workspace.open_files(&mut self.engine, &files, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn reconcile(&mut self, changed: Option<&[PathBuf]>) -> Option<api::Outcome> {
|
|
||||||
self.workspace.reconcile(&mut self.engine, changed)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn save(&mut self, ids: &[Uuid]) {
|
|
||||||
self.workspace
|
|
||||||
.save(&mut self.engine, ids, &BTreeMap::new(), None)
|
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn ids(&self) -> Vec<Uuid> {
|
|
||||||
self.engine.order().iter().map(|id| id.0).collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn id_named(&self, name: &str) -> Uuid {
|
|
||||||
self.ids()
|
|
||||||
.into_iter()
|
|
||||||
.find(|id| self.name(*id) == name)
|
|
||||||
.unwrap()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn name(&self, id: Uuid) -> String {
|
|
||||||
self.engine
|
|
||||||
.file_structure(&FileId(id))
|
|
||||||
.unwrap()
|
|
||||||
.name
|
|
||||||
.clone()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// What the file holds: the name of its track (its own name is the one of the file).
|
|
||||||
fn content(&self, id: Uuid) -> String {
|
|
||||||
self.engine.file_structure(&FileId(id)).unwrap().tracks[0]
|
|
||||||
.info
|
|
||||||
.name
|
|
||||||
.clone()
|
|
||||||
.unwrap_or_default()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn rename(&mut self, id: Uuid, name: &str) {
|
|
||||||
api::select(&mut self.engine, &[id], SelectMode::Replace);
|
|
||||||
assert!(!api::metadata(&mut self.engine, name, "").has_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
fn status(&self, id: Uuid) -> FileStatus {
|
|
||||||
self.workspace
|
|
||||||
.state(&self.engine)
|
|
||||||
.files
|
|
||||||
.remove(&id.to_string())
|
|
||||||
.unwrap()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Drop for Fixture {
|
|
||||||
fn drop(&mut self) {
|
|
||||||
let _ = fs::remove_dir_all(&self.folder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn an_opened_file_is_clean_until_it_is_edited_and_clean_again_once_saved() {
|
|
||||||
let mut fx = Fixture::new();
|
|
||||||
let path = fx.write("a.gpx", "a");
|
|
||||||
fx.workspace
|
|
||||||
.open_files(&mut fx.engine, std::slice::from_ref(&path), true);
|
|
||||||
let id = fx.ids()[0];
|
|
||||||
assert!(!fx.workspace.is_dirty(&fx.engine, id));
|
|
||||||
assert_eq!(fx.status(id).path.as_deref(), path.to_str());
|
|
||||||
|
|
||||||
fx.rename(id, "renamed");
|
|
||||||
assert!(fx.workspace.is_dirty(&fx.engine, id));
|
|
||||||
// nothing is written before it is saved
|
|
||||||
assert!(fs::read_to_string(&path).unwrap().contains(">a<"));
|
|
||||||
|
|
||||||
fx.save(&[id]);
|
|
||||||
assert!(!fx.workspace.is_dirty(&fx.engine, id));
|
|
||||||
assert!(fs::read_to_string(&path).unwrap().contains(">renamed<"));
|
|
||||||
|
|
||||||
// going back before the save is an edit again
|
|
||||||
api::select(&mut fx.engine, &[id], SelectMode::Replace);
|
|
||||||
api::undo(&mut fx.engine);
|
|
||||||
assert!(fx.workspace.is_dirty(&fx.engine, id));
|
|
||||||
api::redo(&mut fx.engine);
|
|
||||||
assert!(!fx.workspace.is_dirty(&fx.engine, id));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn a_file_that_is_not_on_the_disk_is_unsaved_until_it_is_given_a_place() {
|
|
||||||
let mut fx = Fixture::new();
|
|
||||||
api::new_file(&mut fx.engine, "fresh", None, None, None, false);
|
|
||||||
let id = fx.ids()[0];
|
|
||||||
assert!(fx.workspace.is_dirty(&fx.engine, id));
|
|
||||||
assert_eq!(
|
|
||||||
fx.workspace.unlinked(&fx.engine, &[id]),
|
|
||||||
[(id, "fresh".to_string())]
|
|
||||||
);
|
|
||||||
// nowhere to put it without being told
|
|
||||||
fx.save(&[id]);
|
|
||||||
assert!(fx.workspace.is_dirty(&fx.engine, id));
|
|
||||||
|
|
||||||
let path = fx.folder.join("fresh.gpx");
|
|
||||||
let paths = BTreeMap::from([(id, path.clone())]);
|
|
||||||
fx.workspace
|
|
||||||
.save(&mut fx.engine, &[id], &paths, None)
|
|
||||||
.unwrap();
|
|
||||||
assert!(path.exists());
|
|
||||||
assert!(!fx.workspace.is_dirty(&fx.engine, id));
|
|
||||||
assert!(fx.workspace.unlinked(&fx.engine, &[id]).is_empty());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn several_files_without_a_place_go_in_a_folder_with_names_that_are_free() {
|
|
||||||
let mut fx = Fixture::new();
|
|
||||||
fx.write("fresh.gpx", "already there");
|
|
||||||
api::new_file(&mut fx.engine, "fresh", None, None, None, false);
|
|
||||||
api::new_file(&mut fx.engine, "a/b: c", None, None, None, false);
|
|
||||||
api::new_file(&mut fx.engine, "fresh", None, None, None, false);
|
|
||||||
let ids = fx.ids();
|
|
||||||
let folder = fx.folder.clone();
|
|
||||||
fx.workspace
|
|
||||||
.save(&mut fx.engine, &ids, &BTreeMap::new(), Some(&folder))
|
|
||||||
.unwrap();
|
|
||||||
for name in ["fresh (2).gpx", "fresh (3).gpx", "a_b_ c.gpx"] {
|
|
||||||
assert!(fx.folder.join(name).exists(), "{name}");
|
|
||||||
}
|
|
||||||
assert!(ids.iter().all(|id| !fx.workspace.is_dirty(&fx.engine, *id)));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn what_this_app_writes_is_not_a_change_of_the_disk() {
|
|
||||||
let mut fx = Fixture::new();
|
|
||||||
let path = fx.write("a.gpx", "a");
|
|
||||||
fx.open_folder();
|
|
||||||
let id = fx.ids()[0];
|
|
||||||
api::select(&mut fx.engine, &[id], SelectMode::Replace);
|
|
||||||
assert!(!api::style(&mut fx.engine, Some("#ff0000"), None, None).has_error());
|
|
||||||
fx.save(&[id]);
|
|
||||||
assert!(fx.reconcile(Some(&[path])).is_none());
|
|
||||||
assert!(!fx.status(id).replaced && !fx.status(id).dirty);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn the_folders_of_the_files_outside_the_open_folder_are_watched_too() {
|
|
||||||
let mut fx = Fixture::new();
|
|
||||||
let inside = fx.write("in.gpx", "in");
|
|
||||||
let elsewhere = canonical(&std::env::temp_dir()).join(format!("gpx-ws-{}", Uuid::new_v4()));
|
|
||||||
fs::create_dir_all(&elsewhere).unwrap();
|
|
||||||
let (one, two) = (elsewhere.join("one.gpx"), elsewhere.join("two.gpx"));
|
|
||||||
fs::write(&one, gpx("one")).unwrap();
|
|
||||||
fs::write(&two, gpx("two")).unwrap();
|
|
||||||
let folder = fx.folder.clone();
|
|
||||||
|
|
||||||
// no folder: only the folder of the files
|
|
||||||
fx.workspace.open_files(&mut fx.engine, &[one, two], false);
|
|
||||||
assert_eq!(fx.workspace.watched(), [(elsewhere.clone(), false)]);
|
|
||||||
|
|
||||||
// the open folder as a whole, and the file in it needs nothing more
|
|
||||||
fx.workspace.open_folder(&mut fx.engine, &folder, false);
|
|
||||||
fx.workspace.open_files(&mut fx.engine, &[inside], false);
|
|
||||||
assert_eq!(
|
|
||||||
fx.workspace.watched(),
|
|
||||||
[(folder, true), (elsewhere.clone(), false)]
|
|
||||||
);
|
|
||||||
|
|
||||||
// closing the files stops it
|
|
||||||
let ids = fx.ids();
|
|
||||||
fx.workspace.close_files(&mut fx.engine, &ids, true);
|
|
||||||
assert_eq!(fx.workspace.watched(), [(fx.folder.clone(), true)]);
|
|
||||||
fs::remove_dir_all(elsewhere).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn opening_a_folder_does_not_open_its_files() {
|
|
||||||
let mut fx = Fixture::new();
|
|
||||||
fx.write("a.gpx", "a");
|
|
||||||
let folder = fx.folder.clone();
|
|
||||||
let outcome = fx.workspace.open_folder(&mut fx.engine, &folder, false);
|
|
||||||
assert!(!outcome.changed);
|
|
||||||
assert!(fx.ids().is_empty());
|
|
||||||
assert_eq!(fx.workspace.folder.as_deref(), Some(folder.as_path()));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn folders_are_made_renamed_and_moved_and_the_open_files_follow() {
|
|
||||||
let mut fx = Fixture::new();
|
|
||||||
let a = fx.write("a.gpx", "a");
|
|
||||||
fx.open_folder();
|
|
||||||
let id = fx.ids()[0];
|
|
||||||
let root = fx.folder.clone();
|
|
||||||
let path_of = |fx: &Fixture| PathBuf::from(fx.status(id).path.unwrap());
|
|
||||||
|
|
||||||
let first = fx.workspace.create_folder(&root, "New folder").unwrap();
|
|
||||||
let second = fx.workspace.create_folder(&root, "New folder").unwrap();
|
|
||||||
assert_eq!(first, root.join("New folder"));
|
|
||||||
assert_eq!(second, root.join("New folder 2"));
|
|
||||||
|
|
||||||
fx.workspace.move_paths(&[a], &first).unwrap();
|
|
||||||
assert_eq!(path_of(&fx), first.join("a.gpx"));
|
|
||||||
assert!(first.join("a.gpx").exists() && !fx.status(id).dirty);
|
|
||||||
|
|
||||||
let trips = fx.workspace.rename_path(&first, "Trips").unwrap();
|
|
||||||
assert_eq!(path_of(&fx), root.join("Trips/a.gpx"));
|
|
||||||
// a folder does not go into itself, nor onto something else
|
|
||||||
assert!(
|
|
||||||
fx.workspace
|
|
||||||
.move_paths(std::slice::from_ref(&trips), &trips)
|
|
||||||
.is_err()
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
fx.workspace.rename_path(&trips, "New folder 2"),
|
|
||||||
Err(NAME_TAKEN.to_owned())
|
|
||||||
);
|
|
||||||
fx.workspace.move_paths(&[trips], &second).unwrap();
|
|
||||||
assert_eq!(path_of(&fx), second.join("Trips/a.gpx"));
|
|
||||||
|
|
||||||
// a file keeps its extension
|
|
||||||
let closed = fx.write("c.gpx", "c");
|
|
||||||
assert_eq!(
|
|
||||||
fx.workspace.rename_path(&closed, "d").unwrap(),
|
|
||||||
root.join("d.gpx")
|
|
||||||
);
|
|
||||||
// the open folder and what is not in it are left alone
|
|
||||||
assert!(fx.workspace.rename_path(&root, "x").is_err());
|
|
||||||
let elsewhere = canonical(&std::env::temp_dir());
|
|
||||||
assert!(fx.workspace.rename_path(&elsewhere, "x").is_err());
|
|
||||||
assert!(fx.workspace.create_folder(&elsewhere, "x").is_err());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn deleted_files_are_closed_unless_they_have_edits() {
|
|
||||||
let mut fx = Fixture::new();
|
|
||||||
let a = fx.write("a.gpx", "a");
|
|
||||||
let b = fx.write("b.gpx", "b");
|
|
||||||
fx.open_folder();
|
|
||||||
let (id_a, id_b) = (fx.id_named("a"), fx.id_named("b"));
|
|
||||||
api::select(&mut fx.engine, &[id_b], SelectMode::Replace);
|
|
||||||
assert!(!api::style(&mut fx.engine, Some("#ff0000"), None, None).has_error());
|
|
||||||
|
|
||||||
let outcome = fx
|
|
||||||
.workspace
|
|
||||||
.delete_paths(&mut fx.engine, &[a.clone(), b.clone()], |paths| {
|
|
||||||
paths.iter().for_each(|path| fs::remove_file(path).unwrap());
|
|
||||||
Ok(())
|
|
||||||
})
|
|
||||||
.unwrap();
|
|
||||||
assert!(outcome.changed);
|
|
||||||
assert_eq!(fx.ids(), [id_b]);
|
|
||||||
assert!(!fx.ids().contains(&id_a));
|
|
||||||
let status = fx.status(id_b);
|
|
||||||
assert!(status.dirty && status.missing);
|
|
||||||
assert!(!a.exists() && !b.exists());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn the_tree_of_the_folder_shows_folders_first_and_only_gpx_files() {
|
|
||||||
let mut fx = Fixture::new();
|
|
||||||
fx.write("b.gpx", "b");
|
|
||||||
fx.write("A.GPX", "a");
|
|
||||||
fx.write("b 10.gpx", "b 10");
|
|
||||||
fx.write("b 2.gpx", "b 2");
|
|
||||||
fx.write("notes.txt", "not a track");
|
|
||||||
fx.write(".hidden.gpx", "hidden");
|
|
||||||
fs::create_dir(fx.folder.join("zoo")).unwrap();
|
|
||||||
fs::create_dir(fx.folder.join("Alps")).unwrap();
|
|
||||||
fs::create_dir(fx.folder.join(".git")).unwrap();
|
|
||||||
fx.write("zoo/c.gpx", "c");
|
|
||||||
let folder = fx.folder.clone();
|
|
||||||
fx.workspace.open_folder(&mut fx.engine, &folder, false);
|
|
||||||
|
|
||||||
let names = |entries: Vec<Entry>| -> Vec<(String, bool)> {
|
|
||||||
entries.into_iter().map(|e| (e.name, e.is_dir)).collect()
|
|
||||||
};
|
|
||||||
assert_eq!(
|
|
||||||
names(fx.workspace.list_folder(&folder).unwrap()),
|
|
||||||
[
|
|
||||||
("Alps".to_string(), true),
|
|
||||||
("zoo".to_string(), true),
|
|
||||||
("A.GPX".to_string(), false),
|
|
||||||
("b.gpx".to_string(), false),
|
|
||||||
("b 2.gpx".to_string(), false),
|
|
||||||
("b 10.gpx".to_string(), false),
|
|
||||||
]
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
names(fx.workspace.list_folder(&folder.join("zoo")).unwrap()),
|
|
||||||
[("c.gpx".to_string(), false)]
|
|
||||||
);
|
|
||||||
// only what is in the open folder can be listed
|
|
||||||
let elsewhere = canonical(&std::env::temp_dir());
|
|
||||||
assert!(fx.workspace.list_folder(&elsewhere).is_err());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn names_are_sorted_by_the_numbers_they_hold() {
|
|
||||||
let mut names = vec![
|
|
||||||
"track 10",
|
|
||||||
"track 2",
|
|
||||||
"Track 1",
|
|
||||||
"track",
|
|
||||||
"track 02b",
|
|
||||||
"track 2a",
|
|
||||||
"b",
|
|
||||||
"A",
|
|
||||||
];
|
|
||||||
names.sort_by(|a, b| natural_cmp(a, b).then_with(|| a.cmp(b)));
|
|
||||||
assert_eq!(
|
|
||||||
names,
|
|
||||||
[
|
|
||||||
"A",
|
|
||||||
"b",
|
|
||||||
"track",
|
|
||||||
"Track 1",
|
|
||||||
"track 2",
|
|
||||||
"track 2a",
|
|
||||||
"track 02b",
|
|
||||||
"track 10",
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn a_file_without_edits_is_read_again_when_the_disk_changes() {
|
|
||||||
let mut fx = Fixture::new();
|
|
||||||
let a = fx.write("a.gpx", "a");
|
|
||||||
fx.open_folder();
|
|
||||||
let id = fx.ids()[0];
|
|
||||||
|
|
||||||
fx.write("a.gpx", "theirs");
|
|
||||||
let outcome = fx.reconcile(Some(std::slice::from_ref(&a))).unwrap();
|
|
||||||
assert!(outcome.changed);
|
|
||||||
// the same file, now the one on the disk
|
|
||||||
assert_eq!(fx.ids(), [id]);
|
|
||||||
assert_eq!(fx.content(id), "theirs");
|
|
||||||
let status = fx.status(id);
|
|
||||||
assert!(!status.dirty && !status.replaced);
|
|
||||||
// looking again changes nothing
|
|
||||||
assert!(fx.reconcile(Some(std::slice::from_ref(&a))).is_none());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn a_file_with_edits_is_flagged_when_the_disk_changes_and_not_read_again() {
|
|
||||||
let mut fx = Fixture::new();
|
|
||||||
let a = fx.write("a.gpx", "a");
|
|
||||||
fx.open_folder();
|
|
||||||
let id = fx.ids()[0];
|
|
||||||
fx.rename(id, "mine");
|
|
||||||
|
|
||||||
fx.write("a.gpx", "theirs");
|
|
||||||
let outcome = fx.reconcile(Some(std::slice::from_ref(&a))).unwrap();
|
|
||||||
assert!(!outcome.changed);
|
|
||||||
assert_eq!(fx.name(id), "mine");
|
|
||||||
let status = fx.status(id);
|
|
||||||
assert!(status.dirty && status.replaced && !status.missing);
|
|
||||||
// looking again changes nothing
|
|
||||||
assert!(fx.reconcile(Some(std::slice::from_ref(&a))).is_none());
|
|
||||||
|
|
||||||
// the disk goes back to what was read: only the edits are left
|
|
||||||
fx.write("a.gpx", "a");
|
|
||||||
assert!(fx.reconcile(Some(std::slice::from_ref(&a))).is_some());
|
|
||||||
let status = fx.status(id);
|
|
||||||
assert!(status.dirty && !status.replaced);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn the_user_can_take_the_disk_instead_of_the_edits() {
|
|
||||||
let mut fx = Fixture::new();
|
|
||||||
fx.write("a.gpx", "a");
|
|
||||||
fx.open_folder();
|
|
||||||
let id = fx.ids()[0];
|
|
||||||
fx.rename(id, "mine");
|
|
||||||
fx.write("a.gpx", "theirs");
|
|
||||||
fx.reconcile(None);
|
|
||||||
assert!(fx.status(id).replaced);
|
|
||||||
|
|
||||||
fx.workspace.reload(&mut fx.engine, &[id]).unwrap();
|
|
||||||
assert_eq!(fx.content(id), "theirs");
|
|
||||||
let status = fx.status(id);
|
|
||||||
assert!(!status.dirty && !status.replaced);
|
|
||||||
// and it is one undo step
|
|
||||||
api::select(&mut fx.engine, &[id], SelectMode::Replace);
|
|
||||||
api::undo(&mut fx.engine);
|
|
||||||
assert_eq!(fx.content(id), "mine");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn saving_overwrites_what_replaced_the_file() {
|
|
||||||
let mut fx = Fixture::new();
|
|
||||||
let a = fx.write("a.gpx", "a");
|
|
||||||
fx.open_folder();
|
|
||||||
let id = fx.ids()[0];
|
|
||||||
fx.rename(id, "mine");
|
|
||||||
fx.write("a.gpx", "theirs");
|
|
||||||
fx.reconcile(None);
|
|
||||||
assert!(fx.status(id).replaced);
|
|
||||||
|
|
||||||
fx.save(&[id]);
|
|
||||||
assert!(fs::read_to_string(a).unwrap().contains(">mine<"));
|
|
||||||
assert!(!fx.status(id).replaced && !fx.status(id).dirty);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn a_file_that_is_gone_from_the_disk_stays_open_and_dirty_until_it_is_saved_again() {
|
|
||||||
let mut fx = Fixture::new();
|
|
||||||
let a = fx.write("a.gpx", "a");
|
|
||||||
fx.open_folder();
|
|
||||||
let id = fx.ids()[0];
|
|
||||||
|
|
||||||
fs::remove_file(&a).unwrap();
|
|
||||||
assert!(fx.reconcile(Some(std::slice::from_ref(&a))).is_some());
|
|
||||||
assert_eq!(fx.ids(), [id]);
|
|
||||||
let status = fx.status(id);
|
|
||||||
assert!(status.dirty && status.missing && status.path.is_some());
|
|
||||||
|
|
||||||
// saving puts it back
|
|
||||||
fx.save(&[id]);
|
|
||||||
assert!(a.exists());
|
|
||||||
let status = fx.status(id);
|
|
||||||
assert!(!status.dirty && !status.missing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn a_file_that_comes_back_different_is_read_again() {
|
|
||||||
let mut fx = Fixture::new();
|
|
||||||
let a = fx.write("a.gpx", "a");
|
|
||||||
fx.open_folder();
|
|
||||||
let id = fx.ids()[0];
|
|
||||||
fs::remove_file(&a).unwrap();
|
|
||||||
fx.reconcile(None);
|
|
||||||
assert!(fx.status(id).missing);
|
|
||||||
|
|
||||||
fx.write("a.gpx", "back");
|
|
||||||
fx.reconcile(None);
|
|
||||||
assert_eq!(fx.content(id), "back");
|
|
||||||
let status = fx.status(id);
|
|
||||||
assert!(!status.dirty && !status.missing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn what_changed_while_the_app_was_closed_is_found_when_it_starts() {
|
|
||||||
let mut fx = Fixture::new();
|
|
||||||
let a = fx.write("a.gpx", "a");
|
|
||||||
fx.open_folder();
|
|
||||||
let id = fx.ids()[0];
|
|
||||||
fx.write("a.gpx", "changed");
|
|
||||||
assert!(fx.reconcile(None).is_some());
|
|
||||||
assert_eq!(fx.content(id), "changed");
|
|
||||||
fs::remove_file(a).unwrap();
|
|
||||||
assert!(fx.reconcile(None).is_some());
|
|
||||||
assert!(fx.status(id).missing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn new_files_made_from_a_file_of_the_folder_are_saved_next_to_it() {
|
|
||||||
let mut fx = Fixture::new();
|
|
||||||
fs::create_dir(fx.folder.join("sub")).unwrap();
|
|
||||||
fx.write("sub/b.gpx", "b");
|
|
||||||
fx.write("a.gpx", "a");
|
|
||||||
fx.open_folder();
|
|
||||||
let b = fx.id_named("b");
|
|
||||||
let sub = fx.folder.join("sub");
|
|
||||||
assert_eq!(fx.workspace.source_dir(&[b]), Some(canonical(&sub)));
|
|
||||||
|
|
||||||
let before = fx.ids();
|
|
||||||
api::select(&mut fx.engine, &[b], SelectMode::Replace);
|
|
||||||
let outcome = api::duplicate(&mut fx.engine);
|
|
||||||
let copy = fx
|
|
||||||
.ids()
|
|
||||||
.into_iter()
|
|
||||||
.find(|id| !before.contains(id))
|
|
||||||
.unwrap();
|
|
||||||
fx.workspace.inherit(outcome.added(), &canonical(&sub));
|
|
||||||
assert_eq!(fx.status(copy).folder.as_deref(), canonical(&sub).to_str());
|
|
||||||
assert!(fx.status(copy).path.is_none() && fx.status(copy).dirty);
|
|
||||||
// nobody needs to be asked where it goes
|
|
||||||
assert!(fx.workspace.unlinked(&fx.engine, &[copy]).is_empty());
|
|
||||||
|
|
||||||
fx.save(&[copy]);
|
|
||||||
assert!(sub.join("b (2).gpx").exists());
|
|
||||||
let status = fx.status(copy);
|
|
||||||
assert!(!status.dirty && status.folder.is_none());
|
|
||||||
assert_eq!(
|
|
||||||
status.path.as_deref(),
|
|
||||||
canonical(&sub.join("b (2).gpx")).to_str()
|
|
||||||
);
|
|
||||||
// the copy of the copy is next to it as well
|
|
||||||
assert_eq!(fx.workspace.source_dir(&[copy]), Some(canonical(&sub)));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn a_file_outside_the_open_folder_hands_nothing_down() {
|
|
||||||
let mut fx = Fixture::new();
|
|
||||||
let elsewhere = canonical(&std::env::temp_dir()).join(format!("gpx-ws-{}", Uuid::new_v4()));
|
|
||||||
fs::create_dir_all(&elsewhere).unwrap();
|
|
||||||
let outside = elsewhere.join("o.gpx");
|
|
||||||
fs::write(&outside, gpx("o")).unwrap();
|
|
||||||
let folder = fx.folder.clone();
|
|
||||||
fx.workspace.open_folder(&mut fx.engine, &folder, false);
|
|
||||||
fx.workspace
|
|
||||||
.open_files(&mut fx.engine, std::slice::from_ref(&outside), true);
|
|
||||||
let id = fx.ids()[0];
|
|
||||||
assert_eq!(fx.workspace.source_dir(&[id]), None);
|
|
||||||
// a new file with no source is not linked to a folder by `source_dir`: the caller falls back
|
|
||||||
fs::remove_dir_all(elsewhere).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn closing_files_asks_what_to_do_with_the_unsaved_ones() {
|
|
||||||
let mut fx = Fixture::new();
|
|
||||||
fx.write("a.gpx", "a");
|
|
||||||
fx.write("b.gpx", "b");
|
|
||||||
fx.open_folder();
|
|
||||||
let (a, b) = (fx.id_named("a"), fx.id_named("b"));
|
|
||||||
fx.rename(a, "edited");
|
|
||||||
assert_eq!(fx.workspace.unsaved(&fx.engine, &[a, b]), [a]);
|
|
||||||
|
|
||||||
// without a choice what has edits stays
|
|
||||||
let outcome = fx.workspace.close_files(&mut fx.engine, &[a, b], false);
|
|
||||||
assert!(outcome.changed);
|
|
||||||
assert_eq!(fx.ids(), [a]);
|
|
||||||
|
|
||||||
// saved first
|
|
||||||
fx.save(&[a]);
|
|
||||||
fx.workspace.close_files(&mut fx.engine, &[a], false);
|
|
||||||
assert!(fx.ids().is_empty());
|
|
||||||
assert!(
|
|
||||||
fs::read_to_string(fx.folder.join("a.gpx"))
|
|
||||||
.unwrap()
|
|
||||||
.contains("edited")
|
|
||||||
);
|
|
||||||
assert!(fx.workspace.links.is_empty());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn closing_files_can_discard_their_edits() {
|
|
||||||
let mut fx = Fixture::new();
|
|
||||||
fx.write("a.gpx", "a");
|
|
||||||
fx.open_folder();
|
|
||||||
let a = fx.ids()[0];
|
|
||||||
fx.rename(a, "edited");
|
|
||||||
api::new_file(&mut fx.engine, "fresh", None, None, None, false);
|
|
||||||
let fresh = fx.id_named("fresh");
|
|
||||||
fx.workspace.close_files(&mut fx.engine, &[a, fresh], true);
|
|
||||||
assert!(fx.ids().is_empty());
|
|
||||||
assert!(
|
|
||||||
fs::read_to_string(fx.folder.join("a.gpx"))
|
|
||||||
.unwrap()
|
|
||||||
.contains(">a<")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn closing_the_folder_closes_every_file() {
|
|
||||||
let mut fx = Fixture::new();
|
|
||||||
fx.write("a.gpx", "a");
|
|
||||||
fx.open_folder();
|
|
||||||
api::new_file(&mut fx.engine, "fresh", None, None, None, false);
|
|
||||||
assert_eq!(fx.ids().len(), 2);
|
|
||||||
|
|
||||||
// the new file has nowhere to go: it has to be discarded
|
|
||||||
let outcome = fx.workspace.close_folder(&mut fx.engine, false);
|
|
||||||
assert!(outcome.changed);
|
|
||||||
assert_eq!(fx.ids().len(), 1);
|
|
||||||
assert!(fx.workspace.folder.is_none());
|
|
||||||
|
|
||||||
let outcome = fx.workspace.close_folder(&mut fx.engine, true);
|
|
||||||
assert!(outcome.changed);
|
|
||||||
assert!(fx.ids().is_empty());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn opening_another_folder_closes_the_first_with_all_its_files() {
|
|
||||||
let mut fx = Fixture::new();
|
|
||||||
fx.write("a.gpx", "a");
|
|
||||||
fx.open_folder();
|
|
||||||
let a = fx.ids()[0];
|
|
||||||
fx.rename(a, "edited");
|
|
||||||
let other = canonical(&std::env::temp_dir()).join(format!("gpx-ws-{}", Uuid::new_v4()));
|
|
||||||
fs::create_dir_all(&other).unwrap();
|
|
||||||
|
|
||||||
// the edits stay, nothing is lost without a choice
|
|
||||||
fx.workspace.open_folder(&mut fx.engine, &other, false);
|
|
||||||
assert_eq!(fx.ids(), [a]);
|
|
||||||
assert_eq!(fx.workspace.folder.as_deref(), Some(other.as_path()));
|
|
||||||
|
|
||||||
let first = fx.folder.clone();
|
|
||||||
fx.workspace.open_folder(&mut fx.engine, &first, true);
|
|
||||||
assert!(fx.ids().is_empty());
|
|
||||||
assert!(
|
|
||||||
fs::read_to_string(fx.folder.join("a.gpx"))
|
|
||||||
.unwrap()
|
|
||||||
.contains(">a<")
|
|
||||||
);
|
|
||||||
fs::remove_dir_all(other).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn opening_the_same_folder_again_changes_nothing() {
|
|
||||||
let mut fx = Fixture::new();
|
|
||||||
fx.write("a.gpx", "a");
|
|
||||||
fx.open_folder();
|
|
||||||
let folder = fx.folder.clone();
|
|
||||||
let outcome = fx.workspace.open_folder(&mut fx.engine, &folder, true);
|
|
||||||
assert!(!outcome.changed);
|
|
||||||
assert_eq!(fx.ids().len(), 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn a_failed_save_stops_at_the_file_and_leaves_it_dirty() {
|
|
||||||
let mut fx = Fixture::new();
|
|
||||||
fx.write("a.gpx", "a");
|
|
||||||
fx.open_folder();
|
|
||||||
let id = fx.ids()[0];
|
|
||||||
fx.rename(id, "edited");
|
|
||||||
// the place of the file is taken by a folder
|
|
||||||
fs::remove_file(fx.folder.join("a.gpx")).unwrap();
|
|
||||||
fs::create_dir(fx.folder.join("a.gpx")).unwrap();
|
|
||||||
let result = fx
|
|
||||||
.workspace
|
|
||||||
.save(&mut fx.engine, &[id], &BTreeMap::new(), None);
|
|
||||||
assert!(result.is_err());
|
|
||||||
assert!(fx.workspace.is_dirty(&fx.engine, id));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn saving_as_gives_the_file_another_place() {
|
|
||||||
let mut fx = Fixture::new();
|
|
||||||
let a = fx.write("a.gpx", "a");
|
|
||||||
fx.write("b.gpx", "b");
|
|
||||||
fx.open_folder();
|
|
||||||
let id = fx.id_named("a");
|
|
||||||
let other = fx.id_named("b");
|
|
||||||
fx.rename(id, "edited");
|
|
||||||
|
|
||||||
let target = fx.folder.join("copy.gpx");
|
|
||||||
fx.workspace.save_as(&mut fx.engine, id, &target).unwrap();
|
|
||||||
assert!(fs::read_to_string(&target).unwrap().contains("edited"));
|
|
||||||
assert!(fs::read_to_string(a).unwrap().contains(">a<"));
|
|
||||||
let status = fx.status(id);
|
|
||||||
assert!(!status.dirty);
|
|
||||||
assert_eq!(status.path.as_deref(), canonical(&target).to_str());
|
|
||||||
|
|
||||||
// the place of another open file is not available
|
|
||||||
let taken = fx.folder.join("b.gpx");
|
|
||||||
assert!(fx.workspace.save_as(&mut fx.engine, id, &taken).is_err());
|
|
||||||
assert!(!fx.workspace.is_dirty(&fx.engine, other));
|
|
||||||
}
|
|
||||||
|
|
||||||
mod restart {
|
|
||||||
use gpx_engine::Persister;
|
|
||||||
|
|
||||||
use super::*;
|
|
||||||
use gpx_studio_desktop_lib::store::FileStorage;
|
|
||||||
|
|
||||||
/// What the app does when it starts again: the engine and the links are read from what was
|
|
||||||
/// kept.
|
|
||||||
fn restart(engine: &Engine, workspace: &Workspace, root: &Path) -> (Engine, Workspace) {
|
|
||||||
let storage = FileStorage::open(root).unwrap();
|
|
||||||
pollster::block_on(Persister::default().save(&storage, engine.snapshot())).unwrap();
|
|
||||||
let mut restarted = Engine::default();
|
|
||||||
let restored = pollster::block_on(Persister::default().restore(&storage)).unwrap();
|
|
||||||
restarted.restore(restored);
|
|
||||||
let links = serde_json::to_string(workspace).unwrap();
|
|
||||||
(restarted, serde_json::from_str(&links).unwrap())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn setup() -> (PathBuf, Engine, Workspace, Vec<Uuid>) {
|
|
||||||
let root = std::env::temp_dir().join(format!("gpx-restart-{}", Uuid::new_v4()));
|
|
||||||
let folder = root.join("tracks");
|
|
||||||
fs::create_dir_all(&folder).unwrap();
|
|
||||||
for name in ["with_tracks", "with_time", "with_waypoint"] {
|
|
||||||
let _ = fs::copy(
|
|
||||||
format!("../gpx-rs/data/{name}.gpx"),
|
|
||||||
folder.join(format!("{name}.gpx")),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
let mut engine = Engine::default();
|
|
||||||
let mut workspace = Workspace::default();
|
|
||||||
workspace.open_folder(&mut engine, &folder, false);
|
|
||||||
workspace.open_files(&mut engine, &gpx_files(&folder), false);
|
|
||||||
let ids = engine.order().iter().map(|id| id.0).collect();
|
|
||||||
(root, engine, workspace, ids)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn files_that_were_not_edited_are_not_unsaved_after_a_restart() {
|
|
||||||
let (root, engine, workspace, ids) = setup();
|
|
||||||
assert!(ids.len() >= 2);
|
|
||||||
let (restarted, mut workspace) = restart(&engine, &workspace, &root.join("store"));
|
|
||||||
// the files are the same, but the engine knows their contents by new identities
|
|
||||||
assert!(ids.iter().any(|id| workspace.is_dirty(&restarted, *id)));
|
|
||||||
workspace.verify(&restarted);
|
|
||||||
assert!(ids.iter().all(|id| !workspace.is_dirty(&restarted, *id)));
|
|
||||||
fs::remove_dir_all(root).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn files_that_were_edited_are_still_unsaved_after_a_restart() {
|
|
||||||
let (root, mut engine, workspace, ids) = setup();
|
|
||||||
api::select(&mut engine, &[ids[0]], gpx_engine::SelectMode::Replace);
|
|
||||||
api::metadata(&mut engine, "edited", "");
|
|
||||||
assert!(workspace.is_dirty(&engine, ids[0]));
|
|
||||||
let (restarted, mut workspace) = restart(&engine, &workspace, &root.join("store"));
|
|
||||||
workspace.verify(&restarted);
|
|
||||||
assert!(workspace.is_dirty(&restarted, ids[0]));
|
|
||||||
assert!(
|
|
||||||
ids[1..]
|
|
||||||
.iter()
|
|
||||||
.all(|id| !workspace.is_dirty(&restarted, *id))
|
|
||||||
);
|
|
||||||
fs::remove_dir_all(root).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn links_made_before_the_content_was_kept_are_checked_against_the_disk() {
|
|
||||||
let (root, mut engine, mut workspace, ids) = setup();
|
|
||||||
api::select(&mut engine, &[ids[0]], gpx_engine::SelectMode::Replace);
|
|
||||||
api::metadata(&mut engine, "edited", "");
|
|
||||||
for link in workspace.links.values_mut() {
|
|
||||||
link.export_hash = 0;
|
|
||||||
}
|
|
||||||
let (restarted, mut workspace) = restart(&engine, &workspace, &root.join("store"));
|
|
||||||
workspace.verify(&restarted);
|
|
||||||
assert!(workspace.is_dirty(&restarted, ids[0]));
|
|
||||||
assert!(
|
|
||||||
ids[1..]
|
|
||||||
.iter()
|
|
||||||
.all(|id| !workspace.is_dirty(&restarted, *id))
|
|
||||||
);
|
|
||||||
fs::remove_dir_all(root).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn the_folders_of_new_files_and_the_old_flag_name_survive_a_restart() {
|
|
||||||
let (root, engine, mut workspace, ids) = setup();
|
|
||||||
let folder = workspace.folder.clone().unwrap();
|
|
||||||
let fresh = Uuid::new_v4();
|
|
||||||
workspace.inherit(&[fresh.to_string()], &folder);
|
|
||||||
workspace.links.get_mut(&ids[0]).unwrap().replaced = true;
|
|
||||||
let json = serde_json::to_string(&workspace).unwrap();
|
|
||||||
// links written by the previous version had `conflict`, which is the same thing
|
|
||||||
let json = json.replace("\"replaced\"", "\"conflict\"");
|
|
||||||
assert!(json.contains("\"conflict\":true"));
|
|
||||||
let read: Workspace = serde_json::from_str(&json).unwrap();
|
|
||||||
assert!(read.links[&ids[0]].replaced);
|
|
||||||
assert_eq!(read.dirs.get(&fresh), Some(&folder));
|
|
||||||
let _ = engine;
|
|
||||||
fs::remove_dir_all(root).unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
|
||||||
<dependency>
|
|
||||||
<dependentAssembly>
|
|
||||||
<assemblyIdentity
|
|
||||||
type="win32"
|
|
||||||
name="Microsoft.Windows.Common-Controls"
|
|
||||||
version="6.0.0.0"
|
|
||||||
processorArchitecture="*"
|
|
||||||
publicKeyToken="6595b64144ccf1df"
|
|
||||||
language="*"
|
|
||||||
/>
|
|
||||||
</dependentAssembly>
|
|
||||||
</dependency>
|
|
||||||
</assembly>
|
|
||||||
Generated
-26
@@ -44,7 +44,6 @@
|
|||||||
"@typescript-eslint/parser": "^8.33.1",
|
"@typescript-eslint/parser": "^8.33.1",
|
||||||
"bits-ui": "^2.17.2",
|
"bits-ui": "^2.17.2",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"cross-env": "^10.1.0",
|
|
||||||
"eslint": "^9.28.0",
|
"eslint": "^9.28.0",
|
||||||
"eslint-config-prettier": "^10.1.5",
|
"eslint-config-prettier": "^10.1.5",
|
||||||
"eslint-plugin-svelte": "^3.9.1",
|
"eslint-plugin-svelte": "^3.9.1",
|
||||||
@@ -355,13 +354,6 @@
|
|||||||
"tslib": "^2.4.0"
|
"tslib": "^2.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@epic-web/invariant": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@epic-web/invariant/-/invariant-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-lrTPqgvfFQtR/eY/qkIzp98OGdNJu0m5ji3q/nJI8v3SXkRKEnWiOxMmbvcSoAIzv/cGiuvRy57k4suKQSAdwA==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/@esbuild/aix-ppc64": {
|
"node_modules/@esbuild/aix-ppc64": {
|
||||||
"version": "0.27.7",
|
"version": "0.27.7",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.7.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.7.tgz",
|
||||||
@@ -3283,24 +3275,6 @@
|
|||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/cross-env": {
|
|
||||||
"version": "10.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-10.1.0.tgz",
|
|
||||||
"integrity": "sha512-GsYosgnACZTADcmEyJctkJIoqAhHjttw7RsFrVoJNXbsWWqaq6Ym+7kZjq6mS45O0jij6vtiReppKQEtqWy6Dw==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@epic-web/invariant": "^1.0.0",
|
|
||||||
"cross-spawn": "^7.0.6"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"cross-env": "dist/bin/cross-env.js",
|
|
||||||
"cross-env-shell": "dist/bin/cross-env-shell.js"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=20"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/cross-spawn": {
|
"node_modules/cross-spawn": {
|
||||||
"version": "7.0.6",
|
"version": "7.0.6",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite dev",
|
"dev": "vite dev",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"build:desktop": "cross-env BUILD_TARGET=desktop BASE_PATH= vite build",
|
"build:desktop": "BUILD_TARGET=desktop BASE_PATH='' vite build",
|
||||||
"prebuild": "npx tsx src/lib/scripts/pwa-manifest.ts",
|
"prebuild": "npx tsx src/lib/scripts/pwa-manifest.ts",
|
||||||
"postbuild": "npx tsx src/lib/scripts/sitemap.ts",
|
"postbuild": "npx tsx src/lib/scripts/sitemap.ts",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
@@ -39,7 +39,6 @@
|
|||||||
"@typescript-eslint/parser": "^8.33.1",
|
"@typescript-eslint/parser": "^8.33.1",
|
||||||
"bits-ui": "^2.17.2",
|
"bits-ui": "^2.17.2",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"cross-env": "^10.1.0",
|
|
||||||
"eslint": "^9.28.0",
|
"eslint": "^9.28.0",
|
||||||
"eslint-config-prettier": "^10.1.5",
|
"eslint-config-prettier": "^10.1.5",
|
||||||
"eslint-plugin-svelte": "^3.9.1",
|
"eslint-plugin-svelte": "^3.9.1",
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
||||||
|
|
||||||
Add all file items in the current hierarchy level to the selection.
|
Add all file items in the current hierarchy level to the selection.
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Selecciona tot
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Selecciona tot
|
||||||
|
|
||||||
Afegeix a la selecció tots els elements de l'arxiu en el nivell de jerarquia actual.
|
Afegeix a la selecció tots els elements de l'arxiu en el nivell de jerarquia actual.
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Vybrat vše
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Vybrat vše
|
||||||
|
|
||||||
Přidejte k výběru všechny prvky souborů v dané úrovni hierarchie.
|
Přidejte k výběru všechny prvky souborů v dané úrovni hierarchie.
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
||||||
|
|
||||||
Add all file items in the current hierarchy level to the selection.
|
Add all file items in the current hierarchy level to the selection.
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Alle auswählen
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Alle auswählen
|
||||||
|
|
||||||
Alle Dateielemente in der aktuellen Hierarchieebene zur Auswahl hinzufügen.
|
Alle Dateielemente in der aktuellen Hierarchieebene zur Auswahl hinzufügen.
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
||||||
|
|
||||||
Add all file items in the current hierarchy level to the selection.
|
Add all file items in the current hierarchy level to the selection.
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
||||||
|
|
||||||
Add all file items in the current hierarchy level to the selection.
|
Add all file items in the current hierarchy level to the selection.
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Seleccionar todo
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Seleccionar todo
|
||||||
|
|
||||||
Añade todos los elementos del archivo en el nivel de jerarquía actual a la selección.
|
Añade todos los elementos del archivo en el nivel de jerarquía actual a la selección.
|
||||||
|
|||||||
@@ -69,4 +69,4 @@ Global eta tokiko mapa oinarri bilduma handia dago **gpx.studio**-n eskuragarri,
|
|||||||
|
|
||||||
Ezarpen horietan, gainjartzeen opakutasuna ere kudeatu dezakezu.
|
Ezarpen horietan, gainjartzeen opakutasuna ere kudeatu dezakezu.
|
||||||
|
|
||||||
Erabiltzaile aurreratuentzat, oinarrizko mapa pertsonalizatuak eta gainjartzeak gehi daitezke <a href="https://en.wikipedia.org/wiki/Web_Map_Tile_Service" target="_blank">WMTS</a>, <a href="https://en.wikipedia.org/wiki/Web_Map_Service" target="_blank">WMS</a> edo <a href="https://maplibre.org/maplibre-style-spec/" target="_blank">MapLibre estiloko JSON</a> URLak.
|
Erabiltzaile aurreratuentzat, oinarrizko mapa pertsonalizatuak eta gainjartzeak gehi daitezke <a href="https://en.wikipedia.org/wiki/Web_Map_Tile_Service" target="_blank">WMTS</a>, <a href="https://en.wikipedia.org/wiki/Web_Map_Service" target="_blank">WMS</a> edo <a href="https://en.wikipedia.org/wiki/Web_Map_Service" target="_blank">WMS</a>https:///malibrea-spec.org/malibrea-spec. target="_blank">MapLibre estiloko JSON</a> URLak.
|
||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Hautatu denak
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Hautatu denak
|
||||||
|
|
||||||
Gehitu hautapenera uneko hierarkia mailako fitxategi elementu guztiak.
|
Gehitu hautapenera uneko hierarkia mailako fitxategi elementu guztiak.
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
||||||
|
|
||||||
Add all file items in the current hierarchy level to the selection.
|
Add all file items in the current hierarchy level to the selection.
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ En faisant un clic droit sur un onglet de fichier, vous pouvez accéder aux mêm
|
|||||||
|
|
||||||
Comme mentionné dans la [section des options d'affichage](./menu/view), vous pouvez basculer vers une présentation en arborescence pour la liste des fichiers.
|
Comme mentionné dans la [section des options d'affichage](./menu/view), vous pouvez basculer vers une présentation en arborescence pour la liste des fichiers.
|
||||||
Cette disposition est idéale pour gérer un grand nombre de fichiers ouverts, car elle les organise en une liste verticale à droite de la carte.
|
Cette disposition est idéale pour gérer un grand nombre de fichiers ouverts, car elle les organise en une liste verticale à droite de la carte.
|
||||||
De plus, la vue en arborescence des fichiers vous permet d'inspecter les [traces, segments, routes, et points d'intérêt](./gpx) contenus dans les fichiers grâce à des sections pliables.
|
In addition, the file tree view enables you to inspect the [tracks, segments, routes, and points of interest](./gpx) contained inside the files through collapsible sections.
|
||||||
|
|
||||||
Vous pouvez également appliquer les [actions d'édition](./menu/edit) et les [outils](./toolbar) aux éléments intérieurs aux fichiers.
|
Vous pouvez également appliquer les [actions d'édition](./menu/edit) et les [outils](./toolbar) aux éléments intérieurs aux fichiers.
|
||||||
De plus, vous pouvez glisser-déposer les éléments intérieurs pour les réorganiser, ou les déplacer dans la hiérarchie ou même dans un autre fichier.
|
De plus, vous pouvez glisser-déposer les éléments intérieurs pour les réorganiser, ou les déplacer dans la hiérarchie ou même dans un autre fichier.
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ title: Format de fichier GPX
|
|||||||
|
|
||||||
Le format de fichier <a href="https://www.topografix.com/gpx.asp" target="_blank">GPX</a> est un standard ouvert pour l'échange de données GPS entre applications et appareils GPS.
|
Le format de fichier <a href="https://www.topografix.com/gpx.asp" target="_blank">GPX</a> est un standard ouvert pour l'échange de données GPS entre applications et appareils GPS.
|
||||||
Il consiste principalement en une série de points GPS encodant une ou plusieurs traces GPS, et, éventuellement, certains points d'intérêt.
|
Il consiste principalement en une série de points GPS encodant une ou plusieurs traces GPS, et, éventuellement, certains points d'intérêt.
|
||||||
Ces traces peuvent être stockées sous forme de pistes ou de routes.
|
These traces can be stored either as tracks or as routes.
|
||||||
|
|
||||||
Les fichiers GPX peuvent aussi contenir des métadonnées, dont les champs **nom** et **description** sont les plus utiles pour les utilisateurs.
|
Les fichiers GPX peuvent aussi contenir des métadonnées, dont les champs **nom** et **description** sont les plus utiles pour les utilisateurs.
|
||||||
|
|
||||||
@@ -31,15 +31,15 @@ Cependant, la hiérarchie décrite ci-dessus permet des cas d'utilisation plus a
|
|||||||
|
|
||||||
### <Route size="16" class="inline-block" style="margin-bottom: 2px" /> Routes
|
### <Route size="16" class="inline-block" style="margin-bottom: 2px" /> Routes
|
||||||
|
|
||||||
Une **route** est un chemin continu constitué d'une séquence de **points de passage**.
|
A **route** is a single continuous path made of a sequence of **route points**.
|
||||||
Ces points de passage correspondent aux points d'ancrage de [l'outil de routage](./toolbar/routing).
|
These are mandatory checkpoints, which correspond to the anchor points of the [routing tool](./toolbar/routing).
|
||||||
Les points intermédiaires entre les points de passage ne sont qu'un chemin suggéré pour les relier.
|
The points in between are only a suggested path connecting the route points.
|
||||||
Comme une piste, une route peut avoir un **nom**, une **description**, et des **propriétés d'apparence**.
|
Like a track, a route can have a **name**, a **description**, and **appearance properties**.
|
||||||
|
|
||||||
<DocsNote>
|
<DocsNote>
|
||||||
|
|
||||||
De nos jours, la plupart des applications et des appareils GPS fonctionnent parfaitement avec les pistes, même pour la navigation.
|
Nowadays, most apps and GPS devices work perfectly well with tracks, even for navigation.
|
||||||
Cependant, certains d'entre eux ne fonctionnent qu'avec des routes : dans ce cas, vous pouvez [convertir](./menu/edit) vos pistes en routes, ou [créer](./menu/file) un fichier route dès le début.
|
However, some of them only work with routes: in that case, you can [convert](./menu/edit) your tracks to routes, or [create](./menu/file) a route file from the start.
|
||||||
|
|
||||||
</DocsNote>
|
</DocsNote>
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ title: Actions d'édition
|
|||||||
# { title }
|
# { title }
|
||||||
|
|
||||||
Contrairement aux actions sur les fichiers, les actions d'édition peuvent potentiellement modifier le contenu des fichiers sélectionnés.
|
Contrairement aux actions sur les fichiers, les actions d'édition peuvent potentiellement modifier le contenu des fichiers sélectionnés.
|
||||||
De plus, lorsque la présentation en arborescence de la liste de fichiers est activée (voir [Fichiers et statistiques](../files-and-stats)), elles peuvent également être appliquées aux [pistes, segments, routes, et points d'intérêt](../gpx).
|
Moreover, when the tree layout of the files list is enabled (see [Files and statistics](../files-and-stats)), they can also be applied to [tracks, segments, routes, and points of interest](../gpx).
|
||||||
Par conséquent, nous appellerons les éléments qui peuvent être modifiés par ces actions des _éléments de fichier_.
|
Par conséquent, nous appellerons les éléments qui peuvent être modifiés par ces actions des _éléments de fichier_.
|
||||||
Notez que, à part les actions annuler et rétablir, les actions d'édition sont également accessibles via le menu contextuel (clic droit) des éléments de fichier.
|
Notez que, à part les actions annuler et rétablir, les actions d'édition sont également accessibles via le menu contextuel (clic droit) des éléments de fichier.
|
||||||
|
|
||||||
@@ -38,9 +38,9 @@ De plus, la sélection doit contenir un seul fichier.
|
|||||||
|
|
||||||
</DocsNote>
|
</DocsNote>
|
||||||
|
|
||||||
### <Plus size="16" class="inline-block" style="margin-bottom: 2px" /> Nouvelle route
|
### <Plus size="16" class="inline-block" style="margin-bottom: 2px" /> New route
|
||||||
|
|
||||||
Créer une nouvelle route dans le fichier sélectionné.
|
Create a new route in the selected file.
|
||||||
|
|
||||||
<DocsNote>
|
<DocsNote>
|
||||||
|
|
||||||
@@ -60,12 +60,18 @@ De plus, la sélection doit contenir une seule piste.
|
|||||||
|
|
||||||
</DocsNote>
|
</DocsNote>
|
||||||
|
|
||||||
### <ArrowRightLeft size="16" class="inline-block" style="margin-bottom: 2px" /> Convertir en fichier route/piste
|
### <ArrowRightLeft size="16" class="inline-block" style="margin-bottom: 2px" /> Convert to route/track
|
||||||
|
|
||||||
Convertir les routes sélectionnées en pistes, ou les pistes ou segments sélectionnés en routes.
|
Convert the selected routes to tracks, or the selected tracks or segments to routes.
|
||||||
Comme une route a un seul segment, une piste avec plusieurs segments est convertie en une route par segment.
|
Since a route has a single segment, a track with multiple segments is converted into one route per segment.
|
||||||
|
|
||||||
Lorsque les fichiers sélectionnés ne contiennent que des routes, ou seulement des pistes, vous pouvez également les convertir tous en même temps.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Sélectionner tout
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Sélectionner tout
|
||||||
|
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ Le menu des actions sur les fichiers contient un ensemble d'opérations de fichi
|
|||||||
|
|
||||||
Créer un nouveau fichier vide.
|
Créer un nouveau fichier vide.
|
||||||
|
|
||||||
### <Plus size="16" class="inline-block" style="margin-bottom: 2px" />Nouveau fichier route
|
### <Plus size="16" class="inline-block" style="margin-bottom: 2px" /> New route file
|
||||||
|
|
||||||
Créer un nouveau fichier contenant une [route](../gpx) vide.
|
Create a new file containing an empty [route](../gpx).
|
||||||
|
|
||||||
### <FolderOpen size="16" class="inline-block" style="margin-bottom: 2px" /> Ouvrir...
|
### <FolderOpen size="16" class="inline-block" style="margin-bottom: 2px" /> Ouvrir...
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ Masquer le profil altimétrique pour faire de la place pour la carte, ou l'affic
|
|||||||
|
|
||||||
Activer/désactiver la présentation en arborescence pour la [liste de fichiers](../files-and-stats).
|
Activer/désactiver la présentation en arborescence pour la [liste de fichiers](../files-and-stats).
|
||||||
Cette disposition est idéale pour gérer un grand nombre de fichiers ouverts, car elle les organise en une liste verticale à droite de la carte.
|
Cette disposition est idéale pour gérer un grand nombre de fichiers ouverts, car elle les organise en une liste verticale à droite de la carte.
|
||||||
De plus, la vue en arborescence des fichiers vous permet d'inspecter les [traces, segments, routes, et points d'intérêt](../gpx) contenus dans les fichiers grâce à des sections pliables.
|
In addition, the file tree view enables you to inspect the [tracks, segments, routes, and points of interest](../gpx) contained inside the files through collapsible sections.
|
||||||
|
|
||||||
### <Map size="16" class="inline-block" style="margin-bottom: 2px" /> Basculer au fond de carte précédent
|
### <Map size="16" class="inline-block" style="margin-bottom: 2px" /> Basculer au fond de carte précédent
|
||||||
|
|
||||||
@@ -38,13 +38,13 @@ Ceux-ci sont affichés pour la sélection courante, comme le [profil altimétriq
|
|||||||
|
|
||||||
Activer/désactiver la visibilité des flèches de direction sur la carte.
|
Activer/désactiver la visibilité des flèches de direction sur la carte.
|
||||||
|
|
||||||
### <EyeOff size="16" class="inline-block" style="margin-bottom: 2px" /> Cacher/afficher
|
### <EyeOff size="16" class="inline-block" style="margin-bottom: 2px" /> Hide/unhide
|
||||||
|
|
||||||
Activer/désactiver la visibilité des éléments de fichier sélectionnés sur la carte.
|
Toggle the visibility of the selected file items on the map.
|
||||||
|
|
||||||
### <Maximize size="16" class="inline-block" style="margin-bottom: 2px" /> Centrer
|
### <Maximize size="16" class="inline-block" style="margin-bottom: 2px" /> Center
|
||||||
|
|
||||||
Centrer la carte sur les éléments de fichier sélectionnés.
|
Center the map on the selected file items.
|
||||||
|
|
||||||
### <Box size="16" class="inline-block" style="margin-bottom: 2px" /> Activer/désactiver la 3D
|
### <Box size="16" class="inline-block" style="margin-bottom: 2px" /> Activer/désactiver la 3D
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ Cet outil vous permet d'extraire [des pistes (ou des segments)](../gpx) de fichi
|
|||||||
<Extract class="text-foreground p-3 border rounded-md shadow-lg" />
|
<Extract class="text-foreground p-3 border rounded-md shadow-lg" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Appliquer l'outil à un fichier contenant plusieurs [pistes ou routes](../gpx) créera un nouveau fichier pour chacune des pistes et routes qu'il contient.
|
Applying the tool to a file containing multiple [tracks or routes](../gpx) will create a new file for each of the tracks and routes it contains.
|
||||||
De même, appliquer l'outil à une piste contenant plusieurs segments créera (dans le même fichier) une nouvelle piste pour chacun des segments qu'elle contient.
|
De même, appliquer l'outil à une piste contenant plusieurs segments créera (dans le même fichier) une nouvelle piste pour chacun des segments qu'elle contient.
|
||||||
|
|
||||||
<DocsNote>
|
<DocsNote>
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ title: Fusionner
|
|||||||
|
|
||||||
# <Group size="24" class="inline-block" style="margin-bottom: 5px" /> { title }
|
# <Group size="24" class="inline-block" style="margin-bottom: 5px" /> { title }
|
||||||
|
|
||||||
Pour utiliser cet outil, vous devez [sélectionner](../files-and-stats) plusieurs fichiers, [pistes, segments ou routes](../gpx).
|
To use this tool, you need to [select](../files-and-stats) multiple files, [tracks, segments or routes](../gpx).
|
||||||
|
|
||||||
- Si votre objectif est de créer une seule trace continue à partir de votre sélection, utilisez l'option **Connecter les traces** et validez.
|
- Si votre objectif est de créer une seule trace continue à partir de votre sélection, utilisez l'option **Connecter les traces** et validez.
|
||||||
- La deuxième option peut être utilisée pour créer ou gérer des fichiers avec plusieurs [pistes, segments ou routes](../gpx).
|
- The second option can be used to create or manage files with multiple [tracks, segments or routes](../gpx).
|
||||||
Fusionner des fichiers (ou des pistes) résultera en un seul fichier (ou piste) contenant toutes les pistes et routes (ou tous les segments) de la sélection.
|
Merging files (or tracks) will result in a single file (or track) containing all tracks and routes (or segments) from the selection.
|
||||||
|
|
||||||
<DocsNote>
|
<DocsNote>
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,6 @@ Pour diviser la trace sélectionnée en deux parties, cliquez sur l'un des marqu
|
|||||||
Pour diviser à un point précis de votre choix, survolez la trace sur la carte.
|
Pour diviser à un point précis de votre choix, survolez la trace sur la carte.
|
||||||
Des ciseaux apparaîtront à la position du curseur, montrant que vous pouvez diviser la trace à ce point.
|
Des ciseaux apparaîtront à la position du curseur, montrant que vous pouvez diviser la trace à ce point.
|
||||||
|
|
||||||
Vous pouvez choisir de diviser la trace en deux fichiers GPX, ou de créer [une piste, un segment ou une route](../gpx) pour chaque partie dans le même fichier.
|
You can choose to split the trace into two GPX files, or to keep the split parts in the same file as [tracks, segments or routes](../gpx).
|
||||||
|
|
||||||
<DocsImage src="tools/split" alt="Survoler la trace sélectionnée transforme votre curseur en ciseaux." />
|
<DocsImage src="tools/split" alt="Survoler la trace sélectionnée transforme votre curseur en ciseaux." />
|
||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
||||||
|
|
||||||
Add all file items in the current hierarchy level to the selection.
|
Add all file items in the current hierarchy level to the selection.
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Az összes kijelölése
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Az összes kijelölése
|
||||||
|
|
||||||
Az aktuális hierarchiaszinten lévő összes fájlelem hozzáadása a kijelöléshez.
|
Az aktuális hierarchiaszinten lévő összes fájlelem hozzáadása a kijelöléshez.
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
||||||
|
|
||||||
Add all file items in the current hierarchy level to the selection.
|
Add all file items in the current hierarchy level to the selection.
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Seleziona tutto
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Seleziona tutto
|
||||||
|
|
||||||
Aggiunge tutti i file nel corrente livello gerarchico alla selezione.
|
Aggiunge tutti i file nel corrente livello gerarchico alla selezione.
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
||||||
|
|
||||||
Add all file items in the current hierarchy level to the selection.
|
Add all file items in the current hierarchy level to the selection.
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
||||||
|
|
||||||
Add all file items in the current hierarchy level to the selection.
|
Add all file items in the current hierarchy level to the selection.
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
||||||
|
|
||||||
Add all file items in the current hierarchy level to the selection.
|
Add all file items in the current hierarchy level to the selection.
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ Door met de rechtermuisknop te klikken op een tabblad bestanden, kun je dezelfde
|
|||||||
|
|
||||||
Zoals vermeld in de [opties bekijken](./menu/view), kun je schakelen tussen een horizontale en een verticale indeling voor de bestandslijst.
|
Zoals vermeld in de [opties bekijken](./menu/view), kun je schakelen tussen een horizontale en een verticale indeling voor de bestandslijst.
|
||||||
Deze indeling is ideaal voor het beheren van een groot aantal open bestanden, omdat deze geordend worden in een verticale lijst op de rechterkant van de kaart.
|
Deze indeling is ideaal voor het beheren van een groot aantal open bestanden, omdat deze geordend worden in een verticale lijst op de rechterkant van de kaart.
|
||||||
Daarnaast kun je met de boomweergave de [sporen, routes, segmenten, en interessante punten](./gpx) in de bestanden bekijken door middel van inklapbare secties.
|
In addition, the file tree view enables you to inspect the [tracks, segments, routes, and points of interest](./gpx) contained inside the files through collapsible sections.
|
||||||
|
|
||||||
Je kunt ook [bewerk acties](./menu/edit) en [tools](./toolbar) toepassen op interne bestands items.
|
Je kunt ook [bewerk acties](./menu/edit) en [tools](./toolbar) toepassen op interne bestands items.
|
||||||
Bovendien kun je de interne onderdelen slepen en neerzetten om ze te rangschikken, of ze in de hiërarchie of zelfs naar een ander bestand verplaatsen.
|
Bovendien kun je de interne onderdelen slepen en neerzetten om ze te rangschikken, of ze in de hiërarchie of zelfs naar een ander bestand verplaatsen.
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ title: GPX bestandsindeling
|
|||||||
|
|
||||||
De <a href="https://www.topografix.com/gpx.asp" target="_blank">GPX bestandsindeling</a> is open voor het uitwisselen van GPS-gegevens tussen applicaties en GPS-apparaten.
|
De <a href="https://www.topografix.com/gpx.asp" target="_blank">GPX bestandsindeling</a> is open voor het uitwisselen van GPS-gegevens tussen applicaties en GPS-apparaten.
|
||||||
Het bestaat in wezen uit een reeks GPS-punten die één of meerdere GPS-sporen coderen, en eventueel enkele aandachtspunten.
|
Het bestaat in wezen uit een reeks GPS-punten die één of meerdere GPS-sporen coderen, en eventueel enkele aandachtspunten.
|
||||||
Deze sporen kunnen worden opgeslagen als tracks of als routes.
|
These traces can be stored either as tracks or as routes.
|
||||||
|
|
||||||
GPX-bestanden kunnen ook metagegevens bevatten, waarvan de **naam** en **omschrijving** velden het nuttigst zijn voor gebruikers.
|
GPX-bestanden kunnen ook metagegevens bevatten, waarvan de **naam** en **omschrijving** velden het nuttigst zijn voor gebruikers.
|
||||||
|
|
||||||
@@ -29,17 +29,17 @@ Deze zijn georganiseerd in een hiërarchische structuur, met routes op het hoogs
|
|||||||
In de meeste gevallen bevatten GPX-bestanden een enkele route met een enkel segment.
|
In de meeste gevallen bevatten GPX-bestanden een enkele route met een enkel segment.
|
||||||
De hierboven beschreven hiërarchie maakt echter meer geavanceerd gebruik mogelijk, zoals het plannen van meerdaagse reizen met meerdere varianten per dag.
|
De hierboven beschreven hiërarchie maakt echter meer geavanceerd gebruik mogelijk, zoals het plannen van meerdaagse reizen met meerdere varianten per dag.
|
||||||
|
|
||||||
### <Route size="16" class="inline-block" style="margin-bottom: 2px" />Routes
|
### <Route size="16" class="inline-block" style="margin-bottom: 2px" /> Routes
|
||||||
|
|
||||||
Een **route** is een enkel continu pad gemaakt van een reeks van **routepunten**.
|
A **route** is a single continuous path made of a sequence of **route points**.
|
||||||
Dit zijn verplichte checkpoints, die overeenkomen met de ankerpunten van de [routing tool](./toolbar/routing).
|
These are mandatory checkpoints, which correspond to the anchor points of the [routing tool](./toolbar/routing).
|
||||||
De tussenpunten zijn alleen een voorgesteld pad dat de route punten met elkaar verbindt.
|
The points in between are only a suggested path connecting the route points.
|
||||||
Net zoals een track kan een route een **naam**, een **beschrijving** en **uiterlijke eigenschappen** hebben.
|
Like a track, a route can have a **name**, a **description**, and **appearance properties**.
|
||||||
|
|
||||||
<DocsNote>
|
<DocsNote>
|
||||||
|
|
||||||
Tegenwoordig werken de meeste apps en GPS-apparaten perfect met tracks, zelfs voor navigatie.
|
Nowadays, most apps and GPS devices work perfectly well with tracks, even for navigation.
|
||||||
Sommige van hen werken echter alleen met routes: in dat geval, kunt u uw tracks [converteren](./menu/edit) naar routes of een route bestand [maken](./menu/file) vanaf het begin.
|
However, some of them only work with routes: in that case, you can [convert](./menu/edit) your tracks to routes, or [create](./menu/file) a route file from the start.
|
||||||
|
|
||||||
</DocsNote>
|
</DocsNote>
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ title: Bewerkingen
|
|||||||
# { title }
|
# { title }
|
||||||
|
|
||||||
In tegenstelling tot de bestandsacties, kunnen de bewerkingsacties mogelijk de inhoud van de huidige geselecteerde bestanden wijzigen.
|
In tegenstelling tot de bestandsacties, kunnen de bewerkingsacties mogelijk de inhoud van de huidige geselecteerde bestanden wijzigen.
|
||||||
Bovendien, wanneer de verticale indeling van de bestandenlijst is ingeschakeld (zie [Bestanden en statistieken](../files-and-stats)), kunnen deze ook worden toegepast op [tracks, segmenten, routes en interessante punten](../gpx).
|
Moreover, when the tree layout of the files list is enabled (see [Files and statistics](../files-and-stats)), they can also be applied to [tracks, segments, routes, and points of interest](../gpx).
|
||||||
Daarom zullen we verwijzen naar de elementen die door deze acties kunnen worden gewijzigd als _bestanden_.
|
Daarom zullen we verwijzen naar de elementen die door deze acties kunnen worden gewijzigd als _bestanden_.
|
||||||
Merk op dat behalve het ongedaan maken en opnieuw doen de acties ook toegankelijk zijn via het contextmenu (rechtermuisklik) van de bestandsitems.
|
Merk op dat behalve het ongedaan maken en opnieuw doen de acties ook toegankelijk zijn via het contextmenu (rechtermuisklik) van de bestandsitems.
|
||||||
|
|
||||||
@@ -38,9 +38,9 @@ Bovendien moet de selectie een enkel bestand zijn.
|
|||||||
|
|
||||||
</DocsNote>
|
</DocsNote>
|
||||||
|
|
||||||
### <Plus size="16" class="inline-block" style="margin-bottom: 2px" />Nieuwe route
|
### <Plus size="16" class="inline-block" style="margin-bottom: 2px" /> New route
|
||||||
|
|
||||||
Maak een nieuwe route aan in het geselecteerde bestand.
|
Create a new route in the selected file.
|
||||||
|
|
||||||
<DocsNote>
|
<DocsNote>
|
||||||
|
|
||||||
@@ -60,13 +60,19 @@ Bovendien moet de selectie een enkele route zijn.
|
|||||||
|
|
||||||
</DocsNote>
|
</DocsNote>
|
||||||
|
|
||||||
### <ArrowRightLeft size="16" class="inline-block" style="margin-bottom: 2px" />Converteer naar route/track
|
### <ArrowRightLeft size="16" class="inline-block" style="margin-bottom: 2px" /> Convert to route/track
|
||||||
|
|
||||||
Converteer de geselecteerde routes naar tracks, of de geselecteerde tracks of segmenten naar routes.
|
Convert the selected routes to tracks, or the selected tracks or segments to routes.
|
||||||
Since a route has a single segment, a track with multiple segments is converted into one route per segment.
|
Since a route has a single segment, a track with multiple segments is converted into one route per segment.
|
||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Selecteer alles
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Selecteer alles
|
||||||
|
|
||||||
Alle bestanden in het huidige hiërarchie niveau aan de selectie toevoegen.
|
Alle bestanden in het huidige hiërarchie niveau aan de selectie toevoegen.
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
||||||
|
|
||||||
Add all file items in the current hierarchy level to the selection.
|
Add all file items in the current hierarchy level to the selection.
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Zaznacz wszystko
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Zaznacz wszystko
|
||||||
|
|
||||||
Dodaj do zaznaczenia wszystkie pliki na bieżącym poziomie hierarchii.
|
Dodaj do zaznaczenia wszystkie pliki na bieżącym poziomie hierarchii.
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Selecionar tudo
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Selecionar tudo
|
||||||
|
|
||||||
Adicionar todos os itens na hierarquia atual à seleção.
|
Adicionar todos os itens na hierarquia atual à seleção.
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
||||||
|
|
||||||
Add all file items in the current hierarchy level to the selection.
|
Add all file items in the current hierarchy level to the selection.
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
||||||
|
|
||||||
Add all file items in the current hierarchy level to the selection.
|
Add all file items in the current hierarchy level to the selection.
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" />Выбрать всё
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" />Выбрать всё
|
||||||
|
|
||||||
Добавить все файлы текущего уровня иерархии к выделению.
|
Добавить все файлы текущего уровня иерархии к выделению.
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Izaberi sve
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Izaberi sve
|
||||||
|
|
||||||
Dodaj sve stavke datoteke na trenutnom nivou hijerarhije u selekciju.
|
Dodaj sve stavke datoteke na trenutnom nivou hijerarhije u selekciju.
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
||||||
|
|
||||||
Lägg till alla filer i den aktuella hierarkinivån till valet.
|
Lägg till alla filer i den aktuella hierarkinivån till valet.
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
||||||
|
|
||||||
Add all file items in the current hierarchy level to the selection.
|
Add all file items in the current hierarchy level to the selection.
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Hepsini seç
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Hepsini seç
|
||||||
|
|
||||||
Mevcut hiyerarşi düzeyindeki tüm dosya öğelerini seçime ekleyin.
|
Mevcut hiyerarşi düzeyindeki tüm dosya öğelerini seçime ekleyin.
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Вибрати все
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Вибрати все
|
||||||
|
|
||||||
Додати до виділення всі елементи файлу на поточному рівні ієрархії.
|
Додати до виділення всі елементи файлу на поточному рівні ієрархії.
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> Select all
|
||||||
|
|
||||||
Add all file items in the current hierarchy level to the selection.
|
Add all file items in the current hierarchy level to the selection.
|
||||||
|
|||||||
@@ -62,6 +62,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> 全選
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> 全選
|
||||||
|
|
||||||
加入當前檔案層級中所有內容到選取中。
|
加入當前檔案層級中所有內容到選取中。
|
||||||
|
|||||||
@@ -62,6 +62,12 @@ Since a route has a single segment, a track with multiple segments is converted
|
|||||||
|
|
||||||
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
When the selected files contain only routes, or only tracks, you can also convert all of them at once.
|
||||||
|
|
||||||
|
<DocsNote>
|
||||||
|
|
||||||
|
Except for whole files, this action is only available when the tree layout of the files list is enabled.
|
||||||
|
|
||||||
|
</DocsNote>
|
||||||
|
|
||||||
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> 全选
|
### <FileStack size="16" class="inline-block" style="margin-bottom: 2px" /> 全选
|
||||||
|
|
||||||
选中当前文件层级中所有内容。
|
选中当前文件层级中所有内容。
|
||||||
|
|||||||
+36
-36
@@ -9,42 +9,42 @@
|
|||||||
},
|
},
|
||||||
"menu": {
|
"menu": {
|
||||||
"new_file": "Nouveau fichier",
|
"new_file": "Nouveau fichier",
|
||||||
"new_route_file": "Nouveau fichier route",
|
"new_route_file": "New route file",
|
||||||
"new_track": "Nouvelle piste",
|
"new_track": "Nouvelle piste",
|
||||||
"new_route": "Nouvelle route",
|
"new_route": "New route",
|
||||||
"convert_to_route": "Convertir en route",
|
"convert_to_route": "Convert to route",
|
||||||
"convert_to_track": "Convertir en piste",
|
"convert_to_track": "Convert to track",
|
||||||
"convert_to_routes": "Convertir en fichier route",
|
"convert_to_routes": "Convert to route file",
|
||||||
"convert_to_tracks": "Convertir en fichier piste",
|
"convert_to_tracks": "Convert to track file",
|
||||||
"new_segment": "Nouveau segment",
|
"new_segment": "Nouveau segment",
|
||||||
"open": "Ouvrir...",
|
"open": "Ouvrir...",
|
||||||
"open_folder": "Ouvrir le dossier...",
|
"open_folder": "Open folder...",
|
||||||
"explorer": "Explorateur",
|
"explorer": "Explorer",
|
||||||
"explorer_menu": {
|
"explorer_menu": {
|
||||||
"open": "Ouvrir",
|
"open": "Open",
|
||||||
"new_file": "Nouveau fichier...",
|
"new_file": "New file...",
|
||||||
"new_route_file": "Nouveau fichier route...",
|
"new_route_file": "New route file...",
|
||||||
"new_folder": "Nouveau dossier...",
|
"new_folder": "New folder...",
|
||||||
"rename": "Renommer...",
|
"rename": "Rename...",
|
||||||
"reveal_finder": "Afficher dans le Finder",
|
"reveal_finder": "Reveal in Finder",
|
||||||
"reveal": "Afficher dans l'explorateur de fichiers",
|
"reveal": "Reveal in file explorer",
|
||||||
"delete_failed": "Les fichiers n'ont pas pu être déplacés vers la corbeille."
|
"delete_failed": "The files could not be moved to the trash."
|
||||||
},
|
},
|
||||||
"workspace": "Espace de travail",
|
"workspace": "Workspace",
|
||||||
"save": "Enregistrer",
|
"save": "Save",
|
||||||
"save_all": "Enregistrer tout",
|
"save_all": "Save all",
|
||||||
"save_as": "Enregistrer sous...",
|
"save_as": "Save as...",
|
||||||
"close": "Fermer",
|
"close": "Fermer",
|
||||||
"close_all": "Fermer tout",
|
"close_all": "Fermer tout",
|
||||||
"close_folder": "Fermer le dossier",
|
"close_folder": "Close folder",
|
||||||
"reload": "Recharger depuis le disque",
|
"reload": "Reload from disk",
|
||||||
"discard": "Ignorer",
|
"discard": "Discard",
|
||||||
"cancel": "Annuler",
|
"cancel": "Cancel",
|
||||||
"overwrite": "Remplacer",
|
"overwrite": "Overwrite",
|
||||||
"unsaved_title": "Modifications non enregistrées",
|
"unsaved_title": "Unsaved changes",
|
||||||
"unsaved_description": "Ces fichiers ont des modifications qui ne sont pas enregistrées :",
|
"unsaved_description": "These files have changes that are not saved:",
|
||||||
"overwrite_title": "Écraser les modifications apportées ailleurs ?",
|
"overwrite_title": "Overwrite changes made elsewhere?",
|
||||||
"overwrite_description": "Ces fichiers ont des modifications, et ont également été modifiés sur le disque. Écraser ce qui est sur le disque, ou le recharger et perdre vos modifications ?",
|
"overwrite_description": "These files have changes, and were also changed on the disk. Overwrite what is on the disk, or reload it and lose your changes?",
|
||||||
"duplicate": "Dupliquer",
|
"duplicate": "Dupliquer",
|
||||||
"copy": "Copier",
|
"copy": "Copier",
|
||||||
"paste": "Coller",
|
"paste": "Coller",
|
||||||
@@ -101,10 +101,10 @@
|
|||||||
"button": "Infos...",
|
"button": "Infos...",
|
||||||
"name": "Nom",
|
"name": "Nom",
|
||||||
"description": "Description",
|
"description": "Description",
|
||||||
"save": "Enregistrer",
|
"save": "Sauver",
|
||||||
"rename_file": "Renommer le fichier sur le disque",
|
"rename_file": "Rename the file on disk",
|
||||||
"name_taken": "Un fichier portant ce nom existe déjà dans le dossier.",
|
"name_taken": "A file with this name already exists in the folder.",
|
||||||
"rename_failed": "Impossible de renommer le fichier."
|
"rename_failed": "The file could not be renamed."
|
||||||
},
|
},
|
||||||
"style": {
|
"style": {
|
||||||
"button": "Apparence...",
|
"button": "Apparence...",
|
||||||
@@ -595,8 +595,8 @@
|
|||||||
"enable_webgl2": "Découvrir comment activer WebGL 2 dans votre navigateur",
|
"enable_webgl2": "Découvrir comment activer WebGL 2 dans votre navigateur",
|
||||||
"page_not_found": "page introuvable",
|
"page_not_found": "page introuvable",
|
||||||
"outdated": {
|
"outdated": {
|
||||||
"title": "Cette page n'est pas à jour",
|
"title": "This page is out of date",
|
||||||
"description": "Vos fichiers ont été enregistrés par une nouvelle version de gpx.studio, que cette page ne peut pas lire. Rechargez la page pour obtenir la dernière version.",
|
"description": "Your files were saved by a newer version of gpx.studio, which this page cannot read. Reload the page to get the latest version.",
|
||||||
"reload": "Recharger"
|
"reload": "Reload"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+33
-33
@@ -9,42 +9,42 @@
|
|||||||
},
|
},
|
||||||
"menu": {
|
"menu": {
|
||||||
"new_file": "Nieuw bestand",
|
"new_file": "Nieuw bestand",
|
||||||
"new_route_file": "Nieuwe route bestand",
|
"new_route_file": "New route file",
|
||||||
"new_track": "Nieuwe route",
|
"new_track": "Nieuwe route",
|
||||||
"new_route": "Nieuwe route",
|
"new_route": "New route",
|
||||||
"convert_to_route": "Convert to route",
|
"convert_to_route": "Convert to route",
|
||||||
"convert_to_track": "Converteer naar track",
|
"convert_to_track": "Convert to track",
|
||||||
"convert_to_routes": "Convert to route file",
|
"convert_to_routes": "Convert to route file",
|
||||||
"convert_to_tracks": "Converteer naar track bestand",
|
"convert_to_tracks": "Convert to track file",
|
||||||
"new_segment": "Nieuw segment",
|
"new_segment": "Nieuw segment",
|
||||||
"open": "Openen...",
|
"open": "Openen...",
|
||||||
"open_folder": "Open map...",
|
"open_folder": "Open folder...",
|
||||||
"explorer": "Verkenner",
|
"explorer": "Explorer",
|
||||||
"explorer_menu": {
|
"explorer_menu": {
|
||||||
"open": "Openen",
|
"open": "Open",
|
||||||
"new_file": "Nieuw bestand...",
|
"new_file": "New file...",
|
||||||
"new_route_file": "Nieuwe route bestand...",
|
"new_route_file": "New route file...",
|
||||||
"new_folder": "Nieuwe map...",
|
"new_folder": "New folder...",
|
||||||
"rename": "Hernoem...",
|
"rename": "Rename...",
|
||||||
"reveal_finder": "Toon in Finder",
|
"reveal_finder": "Reveal in Finder",
|
||||||
"reveal": "Toon in bestandsverkenner",
|
"reveal": "Reveal in file explorer",
|
||||||
"delete_failed": "De bestanden konden niet naar de prullenbak worden verplaatst."
|
"delete_failed": "The files could not be moved to the trash."
|
||||||
},
|
},
|
||||||
"workspace": "Werkruimte",
|
"workspace": "Workspace",
|
||||||
"save": "Bewaar",
|
"save": "Save",
|
||||||
"save_all": "Alles opslaan",
|
"save_all": "Save all",
|
||||||
"save_as": "Opslaan als...",
|
"save_as": "Save as...",
|
||||||
"close": "Sluiten",
|
"close": "Sluiten",
|
||||||
"close_all": "Alles sluiten",
|
"close_all": "Alles sluiten",
|
||||||
"close_folder": "Sluit map",
|
"close_folder": "Close folder",
|
||||||
"reload": "Herlaad van schijf",
|
"reload": "Reload from disk",
|
||||||
"discard": "Verwijder",
|
"discard": "Discard",
|
||||||
"cancel": "Annuleren",
|
"cancel": "Cancel",
|
||||||
"overwrite": "Overschrijven",
|
"overwrite": "Overwrite",
|
||||||
"unsaved_title": "Niet opgeslagen wijzigingen",
|
"unsaved_title": "Unsaved changes",
|
||||||
"unsaved_description": "Deze bestanden hebben veranderingen die niet zijn opgeslagen:",
|
"unsaved_description": "These files have changes that are not saved:",
|
||||||
"overwrite_title": "Overschrijf wijzigingen die ergens anders gedaan zijn?",
|
"overwrite_title": "Overwrite changes made elsewhere?",
|
||||||
"overwrite_description": "Deze bestanden hebben veranderingen, en zijn ook gewijzigd op de schijf. Overschrijf wat er op de schijf staat, of herlaad en verlies je wijzigingen?",
|
"overwrite_description": "These files have changes, and were also changed on the disk. Overwrite what is on the disk, or reload it and lose your changes?",
|
||||||
"duplicate": "Dupliceren",
|
"duplicate": "Dupliceren",
|
||||||
"copy": "Kopiëren",
|
"copy": "Kopiëren",
|
||||||
"paste": "Plakken",
|
"paste": "Plakken",
|
||||||
@@ -102,9 +102,9 @@
|
|||||||
"name": "Naam",
|
"name": "Naam",
|
||||||
"description": "Beschrijving",
|
"description": "Beschrijving",
|
||||||
"save": "Bewaar",
|
"save": "Bewaar",
|
||||||
"rename_file": "Hernoem het bestand op de schijf",
|
"rename_file": "Rename the file on disk",
|
||||||
"name_taken": "Er bestaat al een bestand met deze naam in de map.",
|
"name_taken": "A file with this name already exists in the folder.",
|
||||||
"rename_failed": "Het bestand kon niet worden hernoemd."
|
"rename_failed": "The file could not be renamed."
|
||||||
},
|
},
|
||||||
"style": {
|
"style": {
|
||||||
"button": "Uiterlijk...",
|
"button": "Uiterlijk...",
|
||||||
@@ -595,8 +595,8 @@
|
|||||||
"enable_webgl2": "Leer hoe je WebGL 2 instelt in uw browser",
|
"enable_webgl2": "Leer hoe je WebGL 2 instelt in uw browser",
|
||||||
"page_not_found": "pagina niet gevonden",
|
"page_not_found": "pagina niet gevonden",
|
||||||
"outdated": {
|
"outdated": {
|
||||||
"title": "Deze pagina is verouderd",
|
"title": "This page is out of date",
|
||||||
"description": "Uw bestanden zijn opgeslagen door een nieuwere versie van gpx.studio, die deze pagina niet kan lezen. Herlaad de pagina om de nieuwste versie te krijgen.",
|
"description": "Your files were saved by a newer version of gpx.studio, which this page cannot read. Reload the page to get the latest version.",
|
||||||
"reload": "Vernieuwen"
|
"reload": "Reload"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user