Skip to content

Commit

Permalink
feat: Add symlink to LLVM in $HOME/.espup/esp-clang
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioGasquez committed Oct 20, 2023
1 parent ea3fe81 commit 54a6c64
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/toolchain/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ use crate::{
toolchain::{download_file, rust::RE_EXTENDED_SEMANTIC_VERSION, Installable},
};
use async_trait::async_trait;
#[cfg(unix)]
use directories::BaseDirs;
use log::{info, warn};
use miette::Result;
use regex::Regex;
#[cfg(unix)]
use std::{fs::create_dir_all, os::unix::fs::symlink};
use std::{
fs::remove_dir_all,
path::{Path, PathBuf},
Expand Down Expand Up @@ -186,7 +190,22 @@ impl Installable for Llvm {
);
}
#[cfg(unix)]
exports.push(format!("export LIBCLANG_PATH=\"{}\"", self.get_lib_path()));
if cfg!(unix) {
exports.push(format!("export LIBCLANG_PATH=\"{}\"", self.get_lib_path()));
let espup_dir = BaseDirs::new().unwrap().home_dir().join(".espup");

if !espup_dir.exists() {
create_dir_all(espup_dir.display().to_string())
.map_err(|_| Error::CreateDirectory(espup_dir.display().to_string()))?;
}
let llvm_symlink_path = espup_dir.join("esp-clang");
println!(
"About to symlink {} and {}",
self.get_lib_path(),
llvm_symlink_path.display()
);
symlink(self.get_lib_path(), llvm_symlink_path)?;
}

if self.extended {
#[cfg(windows)]
Expand Down

0 comments on commit 54a6c64

Please sign in to comment.