Closes #ISSUE Release Notes: - N/A *or* Added/Fixed/Improved ... Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
This commit is contained in:
parent
0b96690446
commit
0625006a9e
3 changed files with 15 additions and 13 deletions
|
@ -524,7 +524,7 @@ mod flatpak {
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
mod windows {
|
mod windows {
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use release_channel::APP_IDENTIFIER;
|
use release_channel::app_identifier;
|
||||||
use windows::{
|
use windows::{
|
||||||
core::HSTRING,
|
core::HSTRING,
|
||||||
Win32::{
|
Win32::{
|
||||||
|
@ -546,7 +546,7 @@ mod windows {
|
||||||
CreateMutexW(
|
CreateMutexW(
|
||||||
None,
|
None,
|
||||||
false,
|
false,
|
||||||
&HSTRING::from(format!("{}-Instance-Mutex", *APP_IDENTIFIER)),
|
&HSTRING::from(format!("{}-Instance-Mutex", app_identifier())),
|
||||||
)
|
)
|
||||||
.expect("Unable to create instance sync event")
|
.expect("Unable to create instance sync event")
|
||||||
};
|
};
|
||||||
|
@ -583,7 +583,7 @@ mod windows {
|
||||||
} else {
|
} else {
|
||||||
unsafe {
|
unsafe {
|
||||||
let pipe = CreateFileW(
|
let pipe = CreateFileW(
|
||||||
&HSTRING::from(format!("\\\\.\\pipe\\{}-Named-Pipe", *APP_IDENTIFIER)),
|
&HSTRING::from(format!("\\\\.\\pipe\\{}-Named-Pipe", app_identifier())),
|
||||||
GENERIC_WRITE.0,
|
GENERIC_WRITE.0,
|
||||||
FILE_SHARE_MODE::default(),
|
FILE_SHARE_MODE::default(),
|
||||||
None,
|
None,
|
||||||
|
|
|
@ -25,12 +25,14 @@ pub static RELEASE_CHANNEL: LazyLock<ReleaseChannel> =
|
||||||
|
|
||||||
/// The app identifier for the current release channel, Windows only.
|
/// The app identifier for the current release channel, Windows only.
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
pub static APP_IDENTIFIER: LazyLock<&str> = LazyLock::new(|| match *RELEASE_CHANNEL {
|
pub fn app_identifier() -> &'static str {
|
||||||
ReleaseChannel::Dev => "Zed-Editor-Dev",
|
match *RELEASE_CHANNEL {
|
||||||
ReleaseChannel::Nightly => "Zed-Editor-Nightly",
|
ReleaseChannel::Dev => "Zed-Editor-Dev",
|
||||||
ReleaseChannel::Preview => "Zed-Editor-Preview",
|
ReleaseChannel::Nightly => "Zed-Editor-Nightly",
|
||||||
ReleaseChannel::Stable => "Zed-Editor-Stable",
|
ReleaseChannel::Preview => "Zed-Editor-Preview",
|
||||||
});
|
ReleaseChannel::Stable => "Zed-Editor-Stable",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// The Git commit SHA that Zed was built at.
|
/// The Git commit SHA that Zed was built at.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
|
|
@ -4,7 +4,7 @@ use anyhow::Context;
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use cli::{ipc::IpcOneShotServer, CliRequest, CliResponse, IpcHandshake};
|
use cli::{ipc::IpcOneShotServer, CliRequest, CliResponse, IpcHandshake};
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use release_channel::APP_IDENTIFIER;
|
use release_channel::app_identifier;
|
||||||
use util::ResultExt;
|
use util::ResultExt;
|
||||||
use windows::{
|
use windows::{
|
||||||
core::HSTRING,
|
core::HSTRING,
|
||||||
|
@ -31,7 +31,7 @@ pub fn check_single_instance(opener: OpenListener, run_foreground: bool) -> bool
|
||||||
CreateMutexW(
|
CreateMutexW(
|
||||||
None,
|
None,
|
||||||
false,
|
false,
|
||||||
&HSTRING::from(format!("{}-Instance-Mutex", *APP_IDENTIFIER)),
|
&HSTRING::from(format!("{}-Instance-Mutex", app_identifier())),
|
||||||
)
|
)
|
||||||
.expect("Unable to create instance sync event")
|
.expect("Unable to create instance sync event")
|
||||||
};
|
};
|
||||||
|
@ -51,7 +51,7 @@ pub fn check_single_instance(opener: OpenListener, run_foreground: bool) -> bool
|
||||||
fn with_pipe(f: impl Fn(String)) {
|
fn with_pipe(f: impl Fn(String)) {
|
||||||
let pipe = unsafe {
|
let pipe = unsafe {
|
||||||
CreateNamedPipeW(
|
CreateNamedPipeW(
|
||||||
&HSTRING::from(format!("\\\\.\\pipe\\{}-Named-Pipe", *APP_IDENTIFIER)),
|
&HSTRING::from(format!("\\\\.\\pipe\\{}-Named-Pipe", app_identifier())),
|
||||||
PIPE_ACCESS_INBOUND,
|
PIPE_ACCESS_INBOUND,
|
||||||
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
|
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
|
||||||
1,
|
1,
|
||||||
|
@ -152,7 +152,7 @@ fn send_args_to_instance() -> anyhow::Result<()> {
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let pipe = CreateFileW(
|
let pipe = CreateFileW(
|
||||||
&HSTRING::from(format!("\\\\.\\pipe\\{}-Named-Pipe", *APP_IDENTIFIER)),
|
&HSTRING::from(format!("\\\\.\\pipe\\{}-Named-Pipe", app_identifier())),
|
||||||
GENERIC_WRITE.0,
|
GENERIC_WRITE.0,
|
||||||
FILE_SHARE_MODE::default(),
|
FILE_SHARE_MODE::default(),
|
||||||
None,
|
None,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue