From 5977fc064448c6c4f6b36085825d1229251f5e6e Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sat, 19 Oct 2019 12:03:04 +0300 Subject: [PATCH] compiler: print relative file paths for files in the current directory --- vlib/compiler/compile_errors.v | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vlib/compiler/compile_errors.v b/vlib/compiler/compile_errors.v index 308d86fa76..fc3c6ee6ea 100644 --- a/vlib/compiler/compile_errors.v +++ b/vlib/compiler/compile_errors.v @@ -133,6 +133,10 @@ fn (s &Scanner) error_with_col(msg string, col int) { fn (s &Scanner) get_error_filepath() string { if s.should_print_relative_paths_on_error { + workdir := os.getwd() + os.path_separator + if s.file_path.starts_with(workdir) { + return s.file_path.replace( workdir, '') + } return s.file_path } return os.realpath( s.file_path )