mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-26 21:41:48 +02:00
fix(single-instance): dbus_path should start with /, can't include -
This commit is contained in:
@@ -35,15 +35,18 @@ pub fn init<R: Runtime>(
|
|||||||
plugin::Builder::new("single-instance")
|
plugin::Builder::new("single-instance")
|
||||||
.setup(move |app, _api| {
|
.setup(move |app, _api| {
|
||||||
let mut dbus_name = dbus_id.unwrap_or_else(|| app.config().identifier.clone());
|
let mut dbus_name = dbus_id.unwrap_or_else(|| app.config().identifier.clone());
|
||||||
dbus_name.push_str(".SingleInstance");
|
|
||||||
|
|
||||||
#[cfg(feature = "semver")]
|
#[cfg(feature = "semver")]
|
||||||
{
|
{
|
||||||
dbus_name.push('_');
|
dbus_name.push('_');
|
||||||
dbus_name.push_str(semver_compat_string(&app.package_info().version).as_str());
|
dbus_name.push_str(semver_compat_string(&app.package_info().version).as_str());
|
||||||
}
|
}
|
||||||
|
dbus_name.push_str(".SingleInstance");
|
||||||
|
|
||||||
let dbus_path = dbus_name.replace('.', "/");
|
let mut dbus_path = dbus_name.replace('.', "/").replace('-', "_");
|
||||||
|
if !dbus_path.starts_with('/') {
|
||||||
|
dbus_path = format!("/{dbus_path}");
|
||||||
|
}
|
||||||
|
|
||||||
let single_instance_dbus = SingleInstanceDBus {
|
let single_instance_dbus = SingleInstanceDBus {
|
||||||
callback,
|
callback,
|
||||||
|
|||||||
Reference in New Issue
Block a user