mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
examples: make examples/templates/templates.v runable from everywhere, not just .
This commit is contained in:
parent
bcb35e15f9
commit
3a65ccd060
@ -171,11 +171,11 @@ fn data_get() []SiteConfig {
|
||||
|
||||
fn data_dump(data []SiteConfig) {
|
||||
a := json.encode_pretty(data)
|
||||
os.write_file('data.json', a) or { panic(err) }
|
||||
os.write_file(os.resource_abs_path('data.json'), a) or { panic(err) }
|
||||
}
|
||||
|
||||
fn data_load() []SiteConfig {
|
||||
data := os.read_file('data.json') or { panic(err) }
|
||||
data := os.read_file(os.resource_abs_path('data.json')) or { panic(err) }
|
||||
a := json.decode([]SiteConfig, data) or { panic(err) }
|
||||
return a
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user