compiler: print relative file paths for files in the current directory

pull/2428/head
Delyan Angelov 2019-10-19 12:03:04 +03:00 committed by Alexander Medvednikov
parent c24d94f87f
commit 5977fc0644
1 changed files with 4 additions and 0 deletions

View File

@ -133,6 +133,10 @@ fn (s &Scanner) error_with_col(msg string, col int) {
fn (s &Scanner) get_error_filepath() string { fn (s &Scanner) get_error_filepath() string {
if s.should_print_relative_paths_on_error { 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 s.file_path
} }
return os.realpath( s.file_path ) return os.realpath( s.file_path )