Skip to content

Commit 5f1ce9a

Browse files
committed
Merge pull request #191 from mattjoss/non-binary-plist
Add ability to use non-binary plist files
2 parents 37a4633 + 23c6aaf commit 5f1ce9a

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"author": "Shazron Abdullah",
2525
"license": "MIT",
2626
"dependencies": {
27+
"plist": "^1.2.0",
2728
"simctl": "^0.0.9",
2829
"nopt": "1.0.9",
2930
"bplist-parser" : "^0.0.6"

src/lib.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ var path = require('path'),
2727
help = require('./help'),
2828
util = require('util'),
2929
simctl,
30-
bplist;
30+
bplist,
31+
plist;
3132

3233
function findFirstAvailableDevice(list) {
3334
/*
@@ -315,11 +316,21 @@ var lib = {
315316
bplist.parseFile(info_plist_path, function(err, obj) {
316317

317318
if (err) {
318-
throw err;
319-
}
319+
// try to see if a regular plist parser will work
320+
if (!plist) {
321+
plist = require('plist');
322+
}
323+
obj = plist.parse(fs.readFileSync(info_plist_path, 'utf8'));
324+
if (obj) {
325+
app_identifier = obj.CFBundleIdentifier;
326+
} else {
327+
throw err;
328+
}
329+
} else {
330+
app_identifier = obj[0].CFBundleIdentifier;
331+
}
320332

321-
app_identifier = obj[0].CFBundleIdentifier;
322-
argv = argv || [];
333+
argv = argv || [];
323334

324335
// get the deviceid from --devicetypeid
325336
// --devicetypeid is a string in the form "devicetype, runtime_version" (optional: runtime_version)

0 commit comments

Comments
 (0)