diff --git a/vimrc b/vimrc index bcfd480..a22a04c 100644 --- a/vimrc +++ b/vimrc @@ -1190,7 +1190,8 @@ function! Build(optimized=0, silent=0) let l:has_jai_build_file = 0 let l:ext = tolower(expand('%:e')) - let l:current_dir = expand('%:p:h') + let l:current_dir = expand('%:p:h') + let l:one_dir_back = expand('%:p:h:h') let l:cmd = "" @@ -1199,15 +1200,16 @@ function! Build(optimized=0, silent=0) " Check for a build file in the current directory or one directory back " (e.g. we're in modules/ or src/, code/, etc) - if filereadable(l:current_dir . "/build.jai") || filereadable(l:current_dir . "/../build.jai") + if filereadable(l:current_dir . "/build.jai") || filereadable(l:one_dir_back . "/build.jai") let l:has_jai_build_file = 1 - let l:cmd = "jai " . l:current_dir . "/" - if filereadable(l:current_dir . "/build.jai") == 1 - let l:cmd .= "build.jai" + let l:cmd = "jai ". l:current_dir . "/build.jai" else - let l:cmd .= "../build.jai" + " It's one directory back. We don't want to include '../' in + " the cmd because then our reported paths in the program get + " botched, e.g. path shown in an assert error. + let l:cmd = "jai " . l:one_dir_back . "/build.jai" endif else let l:cmd = "jai % " @@ -1227,12 +1229,12 @@ function! Build(optimized=0, silent=0) if a:optimized == 1 echo "Compiling release build.jai" " @note We pass 'release' as a user metaprogram arg for the - " build file to parse. -release is a compiler arg and we don't - " want to use that. Ideally the build script would ignore that - " completely. Also we don't bother adding an import directory - " for local modules because the build file should manage that - " sort of thing for us. - let l:cmd .= " - release" + " build file to parse in case it cares about that. -release is + " a compiler arg that we also include because some build + " scripts won't be looking at the user metaprogram args. + " We also don't bother adding an import directory for local modules + " because the build file should manage that sort of thing for us. + let l:cmd .= " -release - release" let l:set_metaprogram_args = 1 else echo "Compiling debug build.jai"