Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'0777', (err) => {
if (err) {
console.log(err);
}
if (os.platform() === 'darwin') {
if (existsSync(`${os.userInfo().homedir}/Library/Preferences/org.motion.Motion-Qt.plist`)) {
bplist.parseFile(`${os.userInfo().homedir}/Library/Preferences/org.motion.Motion-Qt.plist`, (err, plistData) => {
if (err) throw err;
this.$store.commit('SET_MNCONFPATH', {
mnConfPath: plistData[0].strDataDir,
});
this.runDaemon();
});
} else {
this.runDaemon();
}
} else if (os.platform() === 'win32') {
// regedit.list('HKCU\\SOFTWARE\\MOTION\\MOTION-QT', (err, registryData) => {
// if (err) throw err;
// this.$store.commit('SET_MNCONFPATH', {
// mnConfPath: registryData[Object.keys(registryData)[0]].values.strDataDir.value,
steps.push(next => {
const targetInfoPlistPath = path.resolve(stageDirectory, appBundleName, 'Contents/Info.plist')
bplist.parseFile(targetInfoPlistPath, (err, plistArray) => {
if (err) return next(err)
const plist = plistArray[0]
plist.CFBundleIdentifier = opts.bundleId || 'org.littlecorelabs.pkgpackager'
plist.CFBundleShortVersionString = opts.version || '1.0.0'
plist.CFBundleVersion = opts.version || '1.0.0'
plist.CFBundleExecutable = opts.productName
plist.NSHumanReadableCopyright = opts.copyright
plist.CFBundleName = opts.productName
const plistBuf = bplistCtor([plist])
fs.writeFile(targetInfoPlistPath, plistBuf, next)
})
})
var parsePlistFile = function (plist, cb) {
bplistParse.parseFile(plist, function (err, obj) {
if (err) {
logger.debug("Could not parse plist file (as binary) at " + plist);
logger.info("Will try to parse the plist file as XML");
parseXmlPlistFile(plist, function (err, obj) {
if (err) {
logger.debug("Could not parse plist file (as XML) at " + plist);
return cb(err, null);
} else {
logger.debug("Parsed app Info.plist (as XML)");
binaryPlist = false;
cb(null, obj);
}
});
} else {
binaryPlist = true;
if (obj.length) {
function getBundleIdFromApp(appPath, onComplete) {
try {
const absPath = getAppAbsolutePath(appPath);
const infoPlistPath = path.join(absPath, '/Info.plist');
bplist.parseFile(infoPlistPath, function (err, obj) {
if (err) {
onComplete(err);
return;
}
if (Array.isArray(obj)) obj = obj[0];
const bundleId = obj['CFBundleIdentifier'];
if (!bundleId) {
onComplete(new Error(`Field CFBundleIdentifier not found inside Info.plist of app binary at ${absPath}`));
return;
}
onComplete(null, bundleId);
});
} catch (e) {
onComplete(e);
return;
}
export const parseBinaryPList = (filePath, cb) => {
BPList.parseFile(filePath, (err, data) => {
if (err) {
LogUtil.e(`${TAG} parseBinaryPList ${JSON.stringify(err)}`);
cb(err);
return;
}
if (CheckerUtil.isArrayEmpty(data)) {
LogUtil.e(`${TAG} parseBinaryPList invalid array`);
cb(new Error('invalid array'));
return;
}
cb(null, data[0]);
});
};
function processPlist() {
bplist.parseFile(PLIST_FILE, function (err, obj) {
if (err) {
return;
}
coreBluetoothCache = obj[0].CoreBluetoothCache || {};
});
}
IOS.prototype.parseLocalizableStrings = function (cb) {
if (this.args.app === null) {
logger.info("Localizable.strings is not currently supported when using real devices.");
cb();
} else {
var strings = path.resolve(this.args.app, "Localizable.strings");
if (!fs.existsSync(strings)) {
strings = path.resolve(this.args.app, "en.lproj", "Localizable.strings");
}
bplistParse.parseFile(strings, function (err, obj) {
if (err) {
xmlPlistFile(strings, function (err, obj) {
if (err) {
logger.warn("Could not parse plist file at " + strings);
} else {
logger.info("Parsed app Localizable.strings");
this.localizableStrings = obj;
}
cb();
}.bind(this));
} else {
logger.info("Parsed app Localizable.strings");
this.localizableStrings = obj;
cb();
}
}.bind(this));