Skip to content

Commit 3dc7a19

Browse files
committed
try
1 parent 0039916 commit 3dc7a19

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

util/process_wrapper/options.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,21 +139,21 @@ pub(crate) fn options() -> Result<Options, OptionError> {
139139
.to_owned();
140140
let output_base = {
141141
let external = std::path::Path::new(&current_dir).join("external");
142-
match std::fs::read_link(external) {
143-
Ok(target) => target
142+
match std::fs::canonicalize(&external) {
143+
Ok(canonical) => canonical
144144
.parent()
145-
.unwrap_or(&target)
146-
.to_str()
145+
.and_then(|p| p.to_str())
147146
.unwrap_or(&current_dir)
148147
.to_owned(),
149-
Err(_) => {
150-
let cwd = std::path::Path::new(&current_dir);
151-
cwd.parent()
148+
Err(_) => match std::fs::canonicalize(&current_dir) {
149+
Ok(canonical) => canonical
150+
.parent()
152151
.and_then(|p| p.parent())
153152
.and_then(|p| p.to_str())
154153
.unwrap_or(&current_dir)
155-
.to_owned()
156-
}
154+
.to_owned(),
155+
Err(_) => current_dir.clone(),
156+
},
157157
}
158158
};
159159

0 commit comments

Comments
 (0)