Skip to content

Commit

Permalink
Add macOS version checking
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jan 30, 2017
1 parent 82fdaae commit b20de27
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
$ npm install aperture
```

*Requires macOS 10.10 or higher*


## Usage

Expand Down
9 changes: 9 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
'use strict';
const os = require('os');
const path = require('path');
const execa = require('execa');
const tmp = require('tmp');

const isYosemiteOrHigher = process.platform === 'darwin' && Number(os.release().split('.')[0]) >= 14;

// TODO: Log in production with `process.env.DEBUG`
function log(...msgs) {
if (process.env.DEBUG) {
Expand All @@ -11,6 +14,12 @@ function log(...msgs) {
}

class Aperture {
constructor() {
if (!isYosemiteOrHigher) {
throw new Error('Requires macOS 10.10 or higher');
}
}

getAudioSources() {
return execa.stdout(path.join(__dirname, 'swift/main'), ['list-audio-devices']).then(JSON.parse);
}
Expand Down
4 changes: 2 additions & 2 deletions swift/aperture.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
Expand Down Expand Up @@ -216,7 +216,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Expand Down

0 comments on commit b20de27

Please sign in to comment.