mirror of
https://github.com/vlang/v.git
synced 2025-08-03 17:57:59 -04:00
pref: add Preferences.vroot_file/1 (done here, without using it, to ease the bootstrapping of the cheaders extraction, that will follow next)
This commit is contained in:
parent
025e70314c
commit
e9c23144a3
@ -377,3 +377,11 @@ pub fn (p &Preferences) vcross_compiler_name() string {
|
||||
}
|
||||
return 'cc'
|
||||
}
|
||||
|
||||
// vroot_file reads the given file, given a path relative to @VROOT .
|
||||
// Its goal is to give all backends a shared infrastructure to read their own static preludes (like C headers etc),
|
||||
// without each having to implement their own way of lookup/embedding/caching them.
|
||||
pub fn (mut p Preferences) vroot_file(path string) string {
|
||||
full_path := os.join_path(p.vroot, path)
|
||||
return os.read_file(full_path) or { '/* missing vroot content of path: ${full_path} */' }
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user