checkCloneFileSupported return iff Mac OS version is greater or equal to 10.12.x Sierra. clonefile is supported since Mac OS X 10.12 https://www.manpagez.com/man/2/clonefile/ kern.osrelease mapping 17.x.x. macOS 10.13.x High Sierra. 16.x.x macOS 10.12.x Sierra. 15.x.x OS X 10.11.x El Capitan.
()
| 30 | // 16.x.x macOS 10.12.x Sierra. |
| 31 | // 15.x.x OS X 10.11.x El Capitan. |
| 32 | func checkCloneFileSupported() bool { |
| 33 | bytes, err := unix.Sysctl("kern.osrelease") |
| 34 | if err != nil { |
| 35 | return false |
| 36 | } |
| 37 | |
| 38 | versionString := strings.Split(string(bytes), ".") // major.minor.patch |
| 39 | if len(versionString) < 2 { |
| 40 | return false |
| 41 | } |
| 42 | |
| 43 | major, err := strconv.Atoi(versionString[0]) |
| 44 | if err != nil { |
| 45 | return false |
| 46 | } |
| 47 | |
| 48 | return major >= 16 |
| 49 | } |
| 50 | |
| 51 | // CheckCloneFileSupported runs explicit test of clone file on supplied directory. |
| 52 | // This function creates some (src and dst) file in the directory and remove after test finished. |
no outgoing calls