1// Copyright 2015 Keybase, Inc. All rights reserved. Use of 2// this source code is governed by the included BSD license. 3 4// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris 5 6package libkb 7 8import ( 9 "errors" 10 "os" 11) 12 13func canExec(s string) error { 14 fi, err := os.Stat(s) 15 if err != nil { 16 return err 17 } 18 mode := fi.Mode() 19 20 // 21 // Only consider non-directories that have at least one +x 22 // bit set. 23 // 24 // TODO: Recheck this on Windows! 25 // See here for lookpath: http://golang.org/src/pkg/os/exec/lp_windows.go 26 // 27 // Similar to check from exec.LookPath below 28 // See here: http://golang.org/src/pkg/os/exec/lp_unix.go 29 // 30 31 if mode.IsDir() { 32 return DirExecError{Path: s} 33 } 34 35 if mode&0111 == 0 { 36 return FileExecError{Path: s} 37 } 38 39 return nil 40} 41 42func PosixLineEndings(arg string) string { 43 return arg 44} 45 46func AppDataDir() (string, error) { 47 return "", errors.New("unsupported: AppDataDir") 48} 49 50func LocalDataDir() (string, error) { 51 return "", errors.New("unsupported: LocalDataDir") 52} 53 54// SafeWriteToFile is a pass-through to safeWriteToFileOnce on non-Windows. 55func SafeWriteToFile(g SafeWriteLogger, t SafeWriter, mode os.FileMode) error { 56 return safeWriteToFileOnce(g, t, mode) 57} 58 59func renameFile(_ *GlobalContext, src string, dest string) error { 60 return os.Rename(src, dest) 61} 62 63func ChangeMountIcon(oldMount string, newMount string) error { 64 return nil 65} 66