From 9ffbda383352f26e3ee9ffc2e6b90c47c72d0a6d Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sat, 24 Jul 2021 11:08:14 +0300 Subject: [PATCH] v.scanner: improve error diagnostic when scanner's file_path is not a file --- vlib/v/scanner/scanner.v | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vlib/v/scanner/scanner.v b/vlib/v/scanner/scanner.v index b9ff59629d..96e1a2e4b0 100644 --- a/vlib/v/scanner/scanner.v +++ b/vlib/v/scanner/scanner.v @@ -102,8 +102,8 @@ pub enum CommentsMode { // new scanner from file. pub fn new_scanner_file(file_path string, comments_mode CommentsMode, pref &pref.Preferences) &Scanner { - if !os.exists(file_path) { - verror("$file_path doesn't exist") + if !os.is_file(file_path) { + verror('$file_path is not a file') } raw_text := util.read_file(file_path) or { verror(err.msg)