diff --git a/BGMApp/BGMApp.xcodeproj/project.pbxproj b/BGMApp/BGMApp.xcodeproj/project.pbxproj index ae9dfac..55ec70f 100644 --- a/BGMApp/BGMApp.xcodeproj/project.pbxproj +++ b/BGMApp/BGMApp.xcodeproj/project.pbxproj @@ -9,7 +9,6 @@ /* Begin PBXBuildFile section */ 1C0BD0A51BF1A8E6004F4CF5 /* BGMAutoPauseMusicPrefs.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C0BD0A41BF1A8E6004F4CF5 /* BGMAutoPauseMusicPrefs.mm */; }; 1C0BD0A81BF1B029004F4CF5 /* BGMPreferencesMenu.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C0BD0A71BF1B029004F4CF5 /* BGMPreferencesMenu.mm */; }; - 1C1108AE1C444F01003F625E /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1CB8B3421BBA75EF000E2DD1 /* MainMenu.xib */; }; 1C1465B81BCC3A73003AEFE6 /* BGMAutoPauseMusic.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C1465B71BCC3A73003AEFE6 /* BGMAutoPauseMusic.mm */; }; 1C1962E41BC94E15008A4DF7 /* CARingBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C1962E21BC94E15008A4DF7 /* CARingBuffer.cpp */; }; 1C1962E71BC94E91008A4DF7 /* BGMPlayThrough.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C1962E51BC94E91008A4DF7 /* BGMPlayThrough.cpp */; }; @@ -51,6 +50,8 @@ 278D71E91CABB6FF00899CF9 /* BGMXPCHelperTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 279597401C996E2000A002FB /* BGMXPCHelperTests.m */; }; 278D71F61CABBC3B00899CF9 /* BGMXPCHelperTests-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 278D71F51CABBC3B00899CF9 /* BGMXPCHelperTests-Info.plist */; }; 2795973B1C982E4E00A002FB /* BGMXPCListener.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2795973A1C982E4E00A002FB /* BGMXPCListener.mm */; }; + 27977A0C1CD12DBB00C46C96 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1CB8B3421BBA75EF000E2DD1 /* MainMenu.xib */; }; + 27977A0E1CD15F7500C46C96 /* FermataIcon.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 27977A0D1CD15F7500C46C96 /* FermataIcon.pdf */; }; 27D643BE1C9FB84C00737F6E /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 27D643BB1C9FB84C00737F6E /* Info.plist */; }; 27D643C01C9FB99200737F6E /* BGMXPCHelperService.m in Sources */ = {isa = PBXBuildFile; fileRef = 27D643BA1C9FB84C00737F6E /* BGMXPCHelperService.m */; }; 27D643C11C9FB99200737F6E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 27D643BC1C9FB84C00737F6E /* main.m */; }; @@ -166,6 +167,7 @@ 2795973A1C982E4E00A002FB /* BGMXPCListener.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BGMXPCListener.mm; sourceTree = ""; }; 2795973C1C982E8C00A002FB /* BGMXPCListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BGMXPCListener.h; sourceTree = ""; }; 279597401C996E2000A002FB /* BGMXPCHelperTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BGMXPCHelperTests.m; sourceTree = ""; }; + 27977A0D1CD15F7500C46C96 /* FermataIcon.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; name = FermataIcon.pdf; path = Images.xcassets/FermataIcon.imageset/FermataIcon.pdf; sourceTree = ""; }; 27A7DE9D1CCDBBC500ACE97D /* VLC_10.9.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLC_10.9.h; path = "Music Players/VLC_10.9.h"; sourceTree = ""; }; 27B1777C1CCBB0D5000E7BD2 /* BGMPrefixHeader.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BGMPrefixHeader.pch; path = ../SharedSource/BGMPrefixHeader.pch; sourceTree = ""; }; 27D643B41C9FABBD00737F6E /* BGM_Types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BGM_Types.h; path = ../SharedSource/BGM_Types.h; sourceTree = ""; }; @@ -351,6 +353,7 @@ 1CB8B3391BBA75EF000E2DD1 /* Supporting Files */ = { isa = PBXGroup; children = ( + 27977A0D1CD15F7500C46C96 /* FermataIcon.pdf */, 1CED61681C3081C2002CAFCF /* LICENSE */, 1CC1DF951BE8607700FB8FE4 /* Images.xcassets */, 1CB8B33A1BBA75EF000E2DD1 /* Info.plist */, @@ -547,13 +550,14 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 27977A0C1CD12DBB00C46C96 /* MainMenu.xib in Resources */, 2769728C1CAFCEE8007A2F7C /* post_install.sh in Resources */, 2769728E1CAFCEFD007A2F7C /* com.bearisdriving.BGM.XPCHelper.plist.template in Resources */, 27D643BE1C9FB84C00737F6E /* Info.plist in Resources */, 1CED61691C3081C2002CAFCF /* LICENSE in Resources */, 278D71F61CABBC3B00899CF9 /* BGMXPCHelperTests-Info.plist in Resources */, + 27977A0E1CD15F7500C46C96 /* FermataIcon.pdf in Resources */, 1CC1DF961BE8607700FB8FE4 /* Images.xcassets in Resources */, - 1C1108AE1C444F01003F625E /* MainMenu.xib in Resources */, 276972911CB16008007A2F7C /* safe_install_dir.sh in Resources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/BGMApp/BGMApp/AppDelegate.mm b/BGMApp/BGMApp/AppDelegate.mm index 963f54d..9a10006 100644 --- a/BGMApp/BGMApp/AppDelegate.mm +++ b/BGMApp/BGMApp/AppDelegate.mm @@ -63,16 +63,14 @@ static float const kStatusBarIconPadding = 0.25; [icon setSize:NSMakeSize(lengthMinusPadding, lengthMinusPadding)]; statusBarItem.button.image = icon; - } else { + } else +#endif + { // OS X 10.9 fallback. // TODO: It would be better to set this size dynamically, like we do for 10.10+. icon.size = NSMakeSize(16, 16); statusBarItem.image = icon; } -#else - icon.size = NSMakeSize(16, 16); - statusBarItem.image = icon; -#endif } else { // If our icon is missing for some reason, fallback to a fermata character (1D110) #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_9 diff --git a/build_and_install.sh b/build_and_install.sh index f5642ec..71a853e 100755 --- a/build_and_install.sh +++ b/build_and_install.sh @@ -56,6 +56,9 @@ DRIVER_DIR="Background Music Device.driver" XPC_HELPER_PATH="$(BGMApp/BGMXPCHelper/safe_install_dir.sh)" XPC_HELPER_DIR="BGMXPCHelper.xpc" +NIB_PATH="Contents/Resources/Base.lproj" +NIB_NAME="MainMenu.nib" + bold_face() { echo $(tput bold)$*$(tput sgr0) } @@ -187,7 +190,7 @@ show_spinner # BGMXPCHelper echo "[2/3] Installing $(bold_face ${XPC_HELPER_DIR}) to $(bold_face ${XPC_HELPER_PATH})." \ - | tee -a ${LOG_FILE} + | tee -a "${LOG_FILE}" (set +e; sudo xcodebuild -project BGMApp/BGMApp.xcodeproj \ @@ -203,7 +206,7 @@ show_spinner # BGMApp echo "[3/3] Installing $(bold_face ${APP_DIR}) to $(bold_face ${APP_PATH})." \ - | tee -a ${LOG_FILE} + | tee -a "${LOG_FILE}" (set +e; sudo xcodebuild -project BGMApp/BGMApp.xcodeproj \ @@ -221,10 +224,25 @@ show_spinner # same build directory we have to run xcodebuild as root to install BGMApp as well.) sudo chown -R "$(whoami):admin" "${APP_PATH}/${APP_DIR}" +# For some reason, Xcode 6 doesn't always build the .xib. So we do it ourselves. +if ! [[ -e "${APP_PATH}/${APP_DIR}/${NIB_PATH}/${NIB_NAME}" ]]; then + echo "${NIB_NAME} is missing from ${APP_PATH}/${APP_DIR}/${NIB_PATH}/${NIB_NAME}. Compiling" \ + "it with ibtool." >> "${LOG_FILE}" + + IBTOOL=$(xcrun --find ibtool 2>/dev/null || which ibtool) + if [[ -x "${IBTOOL}" ]]; then + mkdir -p "${APP_PATH}/${APP_DIR}/${NIB_PATH}" + "${IBTOOL}" --compile "${APP_PATH}/${APP_DIR}/${NIB_PATH}/${NIB_NAME}" \ + BGMApp/BGMApp/Base.lproj/MainMenu.xib + else + echo "ERROR: ibtool not found (or not executable)." | tee -a "${LOG_FILE}" + fi +fi + # Restart coreaudiod. echo "Restarting coreaudiod to load the virtual audio device." \ - | tee -a ${LOG_FILE} + | tee -a "${LOG_FILE}" # The extra or-clauses are fallback versions of the command that restarts coreaudiod. Apparently # some of these commands don't work with older versions of launchctl, so I figure there's no harm in