diff --git a/asic/src/tofino_common/mod.rs b/asic/src/tofino_common/mod.rs index 104f91d..be63bec 100644 --- a/asic/src/tofino_common/mod.rs +++ b/asic/src/tofino_common/mod.rs @@ -6,6 +6,7 @@ use std::collections::HashMap; use std::ffi::OsStr; +use std::fs; use std::path::PathBuf; use serde::Deserialize; @@ -240,6 +241,10 @@ fn infer_p4_dir() -> AsicResult { let mut exe_path = std::env::current_exe().map_err(|e| { AsicError::P4Missing(format!("looking up dpd path: {e:?}")) })?; + // Canonicalize the path in case we're using a symlinked exe. + exe_path = fs::canonicalize(exe_path).map_err(|e| { + AsicError::P4Missing(format!("canonicalizing dpd path: {e:?}")) + })?; // Pop off the trailing "dpd": exe_path = expect_name(exe_path, "dpd")?;