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

@ -265,10 +265,7 @@ mod imp {
.to_string(); .to_string();
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"))?;

@ -53,8 +53,7 @@ impl FilePath {
#[inline] #[inline]
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().map_err(|_| Error::InvalidPathUrl),
.to_file_path().map_err(|_| Error::InvalidPathUrl),
Self::Path(p) => Ok(p), Self::Path(p) => Ok(p),
} }
} }
@ -89,8 +88,7 @@ impl SafeFilePath {
#[inline] #[inline]
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().map_err(|_| Error::InvalidPathUrl),
.to_file_path().map_err(|_| Error::InvalidPathUrl),
Self::Path(p) => Ok(p.as_ref().to_owned()), Self::Path(p) => Ok(p.as_ref().to_owned()),
} }
} }

@ -56,7 +56,8 @@ 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))} 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.
/// ///
@ -107,7 +108,8 @@ 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))} 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,7 +75,8 @@ 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)} 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