diff --git a/res/com.system76.CosmicFiles.desktop b/res/com.system76.CosmicFiles.desktop index 5d3f0a6..f25060d 100644 --- a/res/com.system76.CosmicFiles.desktop +++ b/res/com.system76.CosmicFiles.desktop @@ -3,7 +3,7 @@ Name=COSMIC Files Name[pl]=Pliki COSMIC Name[pt-BR]=Arquivos do COSMIC -Exec=cosmic-files %F +Exec=cosmic-files %U Terminal=false Type=Application StartupNotify=true diff --git a/src/lib.rs b/src/lib.rs index c6ca345..e0c1e47 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -98,10 +98,21 @@ pub fn main() -> Result<(), Box> { } else if &arg == "--trash" { Location::Trash } else { - match fs::canonicalize(&arg) { + //TODO: support more URLs + let path = match url::Url::parse(&arg) { + Ok(url) => match url.to_file_path() { + Ok(path) => path, + Err(()) => { + log::warn!("invalid argument {:?}", arg); + continue; + } + }, + Err(_) => PathBuf::from(arg), + }; + match fs::canonicalize(&path) { Ok(absolute) => Location::Path(absolute), Err(err) => { - log::warn!("failed to canonicalize {:?}: {}", arg, err); + log::warn!("failed to canonicalize {:?}: {}", path, err); continue; } }