Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const exec = require("child_process").execSync;
- const devicePreferences = exec(
- `/usr/libexec/PlistBuddy -c "Print :DevicePreferences" ~/Library/Preferences/com.apple.iphonesimulator.plist`
- ).toString();
- const regexp = /\s+([A-Za-z0-9-]+)\s=\sDict\s\{/g;
- let matched = [];
- while ((matched = regexp.exec(devicePreferences)) !== null) {
- const simulatorUuid = matched[1];
- try {
- exec(
- `/usr/libexec/PlistBuddy -c "Set :DevicePreferences:${simulatorUuid}:ConnectHardwareKeyboard false" ~/Library/Preferences/com.apple.iphonesimulator.plist`
- );
- } catch (error) {
- exec(
- `/usr/libexec/PlistBuddy -c "Add :DevicePreferences:${simulatorUuid}:ConnectHardwareKeyboard bool false" ~/Library/Preferences/com.apple.iphonesimulator.plist`
- );
- }
- }
Add Comment
Please, Sign In to add comment