Skip to content

Commit

Permalink
chore: use path arg from move_args properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Rqnsom committed Nov 20, 2023
1 parent 6d22b58 commit 99fcbe0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@ enum SmoveCommand {
/// Run the smove CLI.
pub fn smove_cli(cwd: PathBuf) -> Result<()> {
let SmoveArgs { move_args, cmd } = SmoveArgs::parse();
let ctx = RunContext::new(cwd, move_args)?;

let project_root_dir = if let Some(ref project_path) = move_args.package_path {
project_path.canonicalize()?
} else {
cwd
};

let ctx = RunContext::new(project_root_dir, move_args)?;

match cmd {
SmoveCommand::MoveCommand(cmd) => run_move_cli::run_command(&ctx, cmd),
Expand Down
6 changes: 4 additions & 2 deletions src/run_context.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anyhow::{Error, Result};
use anyhow::{Context, Error, Result};
use move_cli::Move as MoveCliArgs;
use move_command_line_common::files::{extension_equals, find_filenames, MOVE_COMPILED_EXTENSION};
use move_core_types::errmap::ErrorMapping;
Expand Down Expand Up @@ -37,7 +37,9 @@ impl RunContext {
let error_descriptions = bcs::from_bytes(move_stdlib::doc::error_descriptions())?;

let manifest_path = project_root_dir.join(layout::SourcePackageLayout::Manifest.path());
let manifest = manifest_parser::parse_move_manifest_from_file(&manifest_path)?;
let manifest = manifest_parser::parse_move_manifest_from_file(&manifest_path).context(
format!("Manifest file not found at {}", project_root_dir.display()),
)?;

Ok(Self {
project_root_dir,
Expand Down

0 comments on commit 99fcbe0

Please sign in to comment.