1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

compiler: produce errors in C "filepath:line:column:" format

This commit is contained in:
Delyan Angelov
2019-08-22 14:15:11 +03:00
committed by Alexander Medvednikov
parent 9b3b22d6b3
commit 77b31de117
5 changed files with 47 additions and 10 deletions

View File

@@ -739,6 +739,26 @@ pub fn getwd() string {
}
}
// Returns the full absolute path for fpath, with all relative ../../, symlinks and so on resolved.
// See http://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html
// Also https://insanecoding.blogspot.com/2007/11/pathmax-simply-isnt.html
// and https://insanecoding.blogspot.com/2007/11/implementing-realpath-in-c.html
// NB: this particular rabbit hole is *deep* ...
pub fn realpath(fpath string) string {
mut fullpath := malloc( MAX_PATH )
mut res := 0
$if windows {
res = int( C._fullpath( fullpath, fpath.str, MAX_PATH ) )
}
$else{
res = int( C.realpath( fpath.str, fullpath ) )
}
if res != 0 {
return string(fullpath, strlen(fullpath))
}
return fpath
}
// walk_ext returns a recursive list of all file paths ending with `ext`.
pub fn walk_ext(path, ext string) []string {
if !os.is_dir(path) {