mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
os: add check for path.len == 0 in vfopen
This commit is contained in:
parent
8c71ba8912
commit
2bd4355a4c
@ -191,6 +191,9 @@ pub fn mv_by_cp(source string, target string) ? {
|
|||||||
// NB: os.vfopen is useful for compatibility with C libraries, that expect `FILE *`.
|
// NB: os.vfopen is useful for compatibility with C libraries, that expect `FILE *`.
|
||||||
// If you write pure V code, os.create or os.open are more convenient.
|
// If you write pure V code, os.create or os.open are more convenient.
|
||||||
pub fn vfopen(path, mode string) ?&C.FILE {
|
pub fn vfopen(path, mode string) ?&C.FILE {
|
||||||
|
if path.len == 0 {
|
||||||
|
return error('vfopen called with ""')
|
||||||
|
}
|
||||||
mut fp := voidptr(0)
|
mut fp := voidptr(0)
|
||||||
$if windows {
|
$if windows {
|
||||||
fp = C._wfopen(path.to_wide(), mode.to_wide())
|
fp = C._wfopen(path.to_wide(), mode.to_wide())
|
||||||
|
Loading…
Reference in New Issue
Block a user