Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional 10.8 support #110

Merged
merged 2 commits into from Aug 8, 2017
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -1,3 +1,9 @@
# core-foundation-rs

[![Build Status](https://travis-ci.org/servo/core-foundation-rs.svg?branch=master)](https://travis-ci.org/servo/core-foundation-rs)

## Compatibility

By default it targets macOS 10.7.

To enable features added in macOS 10.8, set Cargo feature `mac_os_10_8_features`. To have both 10.8 features and 10.7 compatibility, also set `mac_os_10_7_support`. Setting both requires weak linkage, which is is a nighty-only feature as of Rust 1.19.
@@ -10,3 +10,7 @@ build = "build.rs"

[dependencies]
libc = "0.2"

[features]
mac_os_10_7_support = [] # backwards compatibility
mac_os_10_8_features = [] # enables new features
@@ -8,6 +8,8 @@
// except according to those terms.
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, improper_ctypes)]

#![cfg_attr(all(feature="mac_os_10_7_support", feature="mac_os_10_8_features"), feature(linkage))] // back-compat requires weak linkage

extern crate libc;

pub mod array;
@@ -72,10 +72,13 @@ extern {
pub static kCFURLParentDirectoryURLKey: CFStringRef;
pub static kCFURLPreferredIOBlockSizeKey: CFStringRef;
pub static kCFURLTypeIdentifierKey: CFStringRef;
// static kCFURLVolumeIdentifierKey: CFStringRef;
// static kCFURLVolumeURLKey: CFStringRef;
// static kCFURLIsExcludedFromBackupKey: CFStringRef;
// static kCFURLFileResourceTypeKey: CFStringRef;
pub static kCFURLVolumeIdentifierKey: CFStringRef;
pub static kCFURLVolumeURLKey: CFStringRef;

#[cfg(feature="mac_os_10_8_features")]
#[cfg_attr(feature = "mac_os_10_7_support", linkage = "extern_weak")]
pub static kCFURLIsExcludedFromBackupKey: CFStringRef;
pub static kCFURLFileResourceTypeKey: CFStringRef;

/* Creating a CFURL */
pub fn CFURLCopyAbsoluteURL(anURL: CFURLRef) -> CFURLRef;
@@ -151,3 +154,9 @@ extern {
//fn CFURLStartAccessingSecurityScopedResource
//fn CFURLStopAccessingSecurityScopedResource
}

#[test]
#[cfg(feature="mac_os_10_8_features")]
fn can_see_excluded_from_backup_key() {
let _ = unsafe { kCFURLIsExcludedFromBackupKey };
}
@@ -13,3 +13,7 @@ version = "0.4.2"

[dependencies]
libc = "0.2"

[features]
mac_os_10_7_support = ["core-foundation-sys/mac_os_10_7_support"] # backwards compatibility
mac_os_10_8_features = ["core-foundation-sys/mac_os_10_8_features"] # enables new features
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.