Avoid permissions error when installing CLI symlink
This commit is contained in:
committed by
Antonio Scandurra
parent
fbd1afc51f
commit
0d9a0e2cbe
+13
-5
@@ -4,6 +4,7 @@ pub mod settings_file;
|
|||||||
#[cfg(any(test, feature = "test-support"))]
|
#[cfg(any(test, feature = "test-support"))]
|
||||||
pub mod test;
|
pub mod test;
|
||||||
|
|
||||||
|
use anyhow::Context;
|
||||||
use breadcrumbs::Breadcrumbs;
|
use breadcrumbs::Breadcrumbs;
|
||||||
use chat_panel::ChatPanel;
|
use chat_panel::ChatPanel;
|
||||||
pub use client;
|
pub use client;
|
||||||
@@ -69,15 +70,22 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut gpui::MutableAppContext) {
|
|||||||
});
|
});
|
||||||
cx.add_global_action(move |_: &InstallCommandLineTool, cx| {
|
cx.add_global_action(move |_: &InstallCommandLineTool, cx| {
|
||||||
cx.spawn(|cx| async move {
|
cx.spawn(|cx| async move {
|
||||||
let path = cx.platform().path_for_auxiliary_executable("cli")?;
|
log::info!("installing command line launcher");
|
||||||
let link_path = "/usr/local/bin/zed";
|
let cli_path = cx
|
||||||
smol::fs::unix::symlink(link_path, path.as_path()).await?;
|
.platform()
|
||||||
|
.path_for_auxiliary_executable("cli")
|
||||||
|
.log_err()?;
|
||||||
|
let link_path = "/opt/homebrew/bin/zed";
|
||||||
|
smol::fs::unix::symlink(cli_path.as_path(), link_path)
|
||||||
|
.await
|
||||||
|
.context("failed to install cli symlink")
|
||||||
|
.log_err()?;
|
||||||
log::info!(
|
log::info!(
|
||||||
"created symlink {} -> {}",
|
"created symlink {} -> {}",
|
||||||
link_path,
|
link_path,
|
||||||
path.to_string_lossy()
|
cli_path.to_string_lossy()
|
||||||
);
|
);
|
||||||
Ok::<_, anyhow::Error>(())
|
Some(())
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user