mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-19 01:50:32 +00:00
Auto merge of #14402 - Veykril:project-json-sym-link, r=Veykril
internal: Reject symlinks in project-json cc https://github.com/rust-lang/rust-analyzer/pull/14168
This commit is contained in:
commit
fc848495f4
1 changed files with 7 additions and 1 deletions
|
@ -4,7 +4,7 @@
|
|||
|
||||
use std::{collections::VecDeque, fmt, fs, process::Command, sync::Arc};
|
||||
|
||||
use anyhow::{format_err, Context, Result};
|
||||
use anyhow::{bail, format_err, Context, Result};
|
||||
use base_db::{
|
||||
CrateDisplayName, CrateGraph, CrateId, CrateName, CrateOrigin, Dependency, Edition, Env,
|
||||
FileId, LangCrateOrigin, ProcMacroLoadResult, TargetLayoutLoadResult,
|
||||
|
@ -154,6 +154,12 @@ impl ProjectWorkspace {
|
|||
) -> Result<ProjectWorkspace> {
|
||||
let res = match manifest {
|
||||
ProjectManifest::ProjectJson(project_json) => {
|
||||
let metadata = fs::symlink_metadata(&project_json).with_context(|| {
|
||||
format!("Failed to read json file {}", project_json.display())
|
||||
})?;
|
||||
if metadata.is_symlink() {
|
||||
bail!("The project-json may not currently point to a symlink");
|
||||
}
|
||||
let file = fs::read_to_string(&project_json).with_context(|| {
|
||||
format!("Failed to read json file {}", project_json.display())
|
||||
})?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue