mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
solaris: make 'v test-compiler' pass (stage 2)
This commit is contained in:
@@ -6,6 +6,9 @@ const (
|
||||
S_IFMT = 0xF000 // type of file
|
||||
S_IFDIR = 0x4000 // directory
|
||||
S_IFLNK = 0xa000 // link
|
||||
S_IXUSR = 0o100 // is executable by the owner
|
||||
S_IXGRP = 0o010 // is executable by group
|
||||
S_IXOTH = 0o001 // is executable by others
|
||||
)
|
||||
|
||||
const (
|
||||
|
10
vlib/os/os.v
10
vlib/os/os.v
@@ -532,9 +532,15 @@ pub fn is_executable(path string) bool {
|
||||
// 06 Read and write
|
||||
p := os.real_path( path )
|
||||
return ( os.exists( p ) && p.ends_with('.exe') )
|
||||
} $else {
|
||||
return C.access(path.str, X_OK) != -1
|
||||
}
|
||||
$if solaris {
|
||||
statbuf := C.stat{}
|
||||
if C.stat(path.str, &statbuf) != 0 {
|
||||
return false
|
||||
}
|
||||
return (int(statbuf.st_mode) & ( S_IXUSR | S_IXGRP | S_IXOTH )) != 0
|
||||
}
|
||||
return C.access(path.str, X_OK) != -1
|
||||
}
|
||||
|
||||
// `is_writable` returns `true` if `path` is writable.
|
||||
|
Reference in New Issue
Block a user