builder: allow running symlinked .vsh files (#9385)

pull/9393/head
Larpon 2021-03-20 17:25:09 +01:00 committed by GitHub
parent 517c1841c1
commit b7a0c44f39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -122,7 +122,7 @@ fn (mut v Builder) cleanup_run_executable_after_exit(exefile string) {
v.pref.vrun_elog('keeping executable: $exefile , because -keepc was passed') v.pref.vrun_elog('keeping executable: $exefile , because -keepc was passed')
return return
} }
if os.is_file(exefile) { if os.is_executable(exefile) {
v.pref.vrun_elog('remove run executable: $exefile') v.pref.vrun_elog('remove run executable: $exefile')
os.rm(exefile) or { panic(err) } os.rm(exefile) or { panic(err) }
} }
@ -273,8 +273,10 @@ pub fn (v &Builder) get_user_files() []string {
exit(1) exit(1)
} }
is_real_file := does_exist && !os.is_dir(dir) is_real_file := does_exist && !os.is_dir(dir)
if is_real_file && (dir.ends_with('.v') || dir.ends_with('.vsh') || dir.ends_with('.vv')) { resolved_link := if is_real_file && os.is_link(dir) { os.real_path(dir) } else { dir }
single_v_file := dir if is_real_file && (dir.ends_with('.v') || resolved_link.ends_with('.vsh')
|| dir.ends_with('.vv')) {
single_v_file := if resolved_link.ends_with('.vsh') { resolved_link } else { dir }
// Just compile one file and get parent dir // Just compile one file and get parent dir
user_files << single_v_file user_files << single_v_file
if v.pref.is_verbose { if v.pref.is_verbose {