Skip to content

Commit

Permalink
fix(wallpaper): folders and images containing spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
mmstick committed Dec 14, 2023
1 parent 704db5e commit a8257e4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/src/pages/desktop/wallpaper/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,16 @@ impl page::Page<crate::pages::Message> for Page {
self.active_dialog = ActiveDialog::None;

if let Some(selection) = selections.first() {
let path = PathBuf::from(selection.path());
let Ok(path) = selection.to_file_path() else {
tracing::error!(path = selection.path(), "not a valid file path");
return Command::none();
};

match active_dialog {
ActiveDialog::AddFolder => {
if path.is_dir() {
tracing::info!(?path, "opening new folder");

let _res = self.config.set_current_folder(Some(path.clone()));

// Add the selected folder to the recent folders list.
Expand All @@ -222,6 +227,8 @@ impl page::Page<crate::pages::Message> for Page {

ActiveDialog::AddImage => {
if path.is_file() {
tracing::info!(?path, "opening custom image");

// Loads a single custom image and its thumbnail for display in the backgrounds view.
return cosmic::command::future(async move {
let result =
Expand Down

0 comments on commit a8257e4

Please sign in to comment.