mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
os: add os.symlink() function
This commit is contained in:
committed by
Alexander Medvednikov
parent
7518d2d0dc
commit
06fba73ab9
@@ -6,6 +6,8 @@ pub const (
|
||||
path_separator = '/'
|
||||
)
|
||||
|
||||
fn C.symlink(charptr, charptr) int
|
||||
|
||||
pub fn init_os_args(argc int, argv &byteptr) []string {
|
||||
mut args := []string
|
||||
for i in 0 .. argc {
|
||||
@@ -98,3 +100,8 @@ pub fn exec(cmd string) ?Result {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn symlink(origin, target string) ?bool {
|
||||
res := C.symlink(origin.str, target.str)
|
||||
if res == 0 { return true }
|
||||
return error(get_error_msg(C.errno))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user