diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/editor/src/main.rs | 10 | ||||
-rw-r--r-- | examples/todos/Cargo.toml | 2 | ||||
-rw-r--r-- | examples/todos/src/main.rs | 2 |
3 files changed, 11 insertions, 3 deletions
diff --git a/examples/editor/src/main.rs b/examples/editor/src/main.rs index 7032324a..c039672e 100644 --- a/examples/editor/src/main.rs +++ b/examples/editor/src/main.rs @@ -117,8 +117,16 @@ impl Editor { } else { self.is_loading = true; + let mut text = self.content.text(); + + if let Some(ending) = self.content.line_ending() { + if !text.ends_with(ending.as_str()) { + text.push_str(ending.as_str()); + } + } + Task::perform( - save_file(self.file.clone(), self.content.text()), + save_file(self.file.clone(), text), Message::FileSaved, ) } diff --git a/examples/todos/Cargo.toml b/examples/todos/Cargo.toml index 16f4fdd2..5d42a88d 100644 --- a/examples/todos/Cargo.toml +++ b/examples/todos/Cargo.toml @@ -15,7 +15,7 @@ uuid = { version = "1.0", features = ["v4", "fast-rng", "serde"] } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] async-std.workspace = true -directories-next = "2.0" +directories = "6.0" tracing-subscriber = "0.3" [target.'cfg(target_arch = "wasm32")'.dependencies] diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs index 7759552c..7faf742e 100644 --- a/examples/todos/src/main.rs +++ b/examples/todos/src/main.rs @@ -490,7 +490,7 @@ enum SaveError { impl SavedState { fn path() -> std::path::PathBuf { let mut path = if let Some(project_dirs) = - directories_next::ProjectDirs::from("rs", "Iced", "Todos") + directories::ProjectDirs::from("rs", "Iced", "Todos") { project_dirs.data_dir().into() } else { |