pull/2445/head
FabianLars 5 months ago
parent 346c9a9b28
commit 6230404fcb
No known key found for this signature in database

@ -267,16 +267,16 @@ mod imp {
let key_reg = CURRENT_USER.create(&key_base)?; let key_reg = CURRENT_USER.create(&key_base)?;
key_reg.set_string( key_reg.set_string(
"", "",
&format!("URL:{} protocol", self.app.config().identifier), format!("URL:{} protocol", self.app.config().identifier),
)?; )?;
key_reg.set_string("URL Protocol", "")?; key_reg.set_string("URL Protocol", "")?;
let icon_reg = CURRENT_USER.create(format!("{key_base}\\DefaultIcon"))?; let icon_reg = CURRENT_USER.create(format!("{key_base}\\DefaultIcon"))?;
icon_reg.set_string("", &format!("{exe},0"))?; icon_reg.set_string("", format!("{exe},0"))?;
let cmd_reg = CURRENT_USER.create(format!("{key_base}\\shell\\open\\command"))?; let cmd_reg = CURRENT_USER.create(format!("{key_base}\\shell\\open\\command"))?;
cmd_reg.set_string("", &format!("\"{exe}\" \"%1\""))?; cmd_reg.set_string("", format!("\"{exe}\" \"%1\""))?;
Ok(()) Ok(())
} }

@ -54,9 +54,7 @@ impl FilePath {
pub fn into_path(self) -> Result<PathBuf> { pub fn into_path(self) -> Result<PathBuf> {
match self { match self {
Self::Url(url) => url Self::Url(url) => url
.to_file_path() .to_file_path().map_err(|_| Error::InvalidPathUrl),
.map(PathBuf::from)
.map_err(|_| Error::InvalidPathUrl),
Self::Path(p) => Ok(p), Self::Path(p) => Ok(p),
} }
} }
@ -92,9 +90,7 @@ impl SafeFilePath {
pub fn into_path(self) -> Result<PathBuf> { pub fn into_path(self) -> Result<PathBuf> {
match self { match self {
Self::Url(url) => url Self::Url(url) => url
.to_file_path() .to_file_path().map_err(|_| Error::InvalidPathUrl),
.map(PathBuf::from)
.map_err(|_| Error::InvalidPathUrl),
Self::Path(p) => Ok(p.as_ref().to_owned()), Self::Path(p) => Ok(p.as_ref().to_owned()),
} }
} }

@ -56,8 +56,7 @@ impl<R: Runtime> Opener<R> {
/// - **Android / iOS**: Always opens using default program. /// - **Android / iOS**: Always opens using default program.
#[cfg(desktop)] #[cfg(desktop)]
pub fn open_url(&self, url: impl Into<String>, with: Option<impl Into<String>>) -> Result<()> { pub fn open_url(&self, url: impl Into<String>, with: Option<impl Into<String>>) -> Result<()> {
crate::open::open(url.into(), with.map(Into::into)).map_err(Into::into) crate::open::open(url.into(), with.map(Into::into))}
}
/// Open a url with a default or specific program. /// Open a url with a default or specific program.
/// ///
@ -108,8 +107,7 @@ impl<R: Runtime> Opener<R> {
path: impl Into<String>, path: impl Into<String>,
with: Option<impl Into<String>>, with: Option<impl Into<String>>,
) -> Result<()> { ) -> Result<()> {
crate::open::open(path.into(), with.map(Into::into)).map_err(Into::into) crate::open::open(path.into(), with.map(Into::into))}
}
/// Open a path with a default or specific program. /// Open a path with a default or specific program.
/// ///

@ -75,8 +75,7 @@ impl<R: Runtime> Shell<R> {
#[deprecated(since = "2.1.0", note = "Use tauri-plugin-opener instead.")] #[deprecated(since = "2.1.0", note = "Use tauri-plugin-opener instead.")]
#[allow(deprecated)] #[allow(deprecated)]
pub fn open(&self, path: impl Into<String>, with: Option<open::Program>) -> Result<()> { pub fn open(&self, path: impl Into<String>, with: Option<open::Program>) -> Result<()> {
open::open(&self.open_scope, path.into(), with).map_err(Into::into) open::open(&self.open_scope, path.into(), with)}
}
/// Open a (url) path with a default or specific browser opening program. /// Open a (url) path with a default or specific browser opening program.
/// ///

Loading…
Cancel
Save