From 3b64f01538c52bf9595584c830d9d80b58924ca6 Mon Sep 17 00:00:00 2001 From: Victor Porton Date: Fri, 26 Apr 2024 06:14:33 +0300 Subject: [PATCH] bug fix --- src/dfx/src/lib/builders/motoko.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dfx/src/lib/builders/motoko.rs b/src/dfx/src/lib/builders/motoko.rs index 8e80201294..f37f50a3a2 100644 --- a/src/dfx/src/lib/builders/motoko.rs +++ b/src/dfx/src/lib/builders/motoko.rs @@ -9,7 +9,7 @@ use crate::lib::metadata::names::{CANDID_ARGS, CANDID_SERVICE}; use crate::lib::models::canister::{CanisterPool, Import, ImportsTracker}; use crate::lib::package_arguments::{self, PackageArguments}; use crate::util::assets::management_idl; -use anyhow::Context; +use anyhow::{Context, anyhow}; use candid::Principal as CanisterId; use dfx_core::config::cache::Cache; use dfx_core::config::model::dfinity::{MetadataVisibility, Profile}; @@ -57,7 +57,7 @@ pub fn add_imports( pool: &CanisterPool, top: Option<&CanisterInfo>, // hackish ) -> DfxResult { - let base_path = file.parent().unwrap(); // FIXME: `unwrap()` + let base_path = file.parent().ok_or_else(|| anyhow!("Cannot get base directory"))?; let parent = if let Some(top) = top { Import::Canister(top.get_name().to_string()) // a little inefficient } else {