Skip to content

Commit

Permalink
fix: check for V executable before trying to format
Browse files Browse the repository at this point in the history
revert v.mod file embed
  • Loading branch information
ttytm committed Nov 5, 2023
1 parent ebc8287 commit 5b936c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/cli.v
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct Settings {
skip_fmt bool
}

const manifest = vmod.decode($embed_file('../v.mod').to_string()) or { panic(err) }
const manifest = vmod.decode(@VMOD_FILE) or { panic(err) }

fn start_cli() {
mut app := cli.Command{
Expand Down
4 changes: 3 additions & 1 deletion src/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ fn run(cmd cli.Command) ! {
}

if !s.skip_fmt {
os.execute_opt('${@VEXE} fmt -w ${s.output}') or { error_and_exit(err) }
if v := os.find_abs_path_of_executable('v') {
os.execute_opt('${v} fmt -w ${s.output}') or { error_and_exit(err) }
}
}

verbose_print(s.verbose, 'Completed.')
Expand Down

0 comments on commit 5b936c2

Please sign in to comment.