Skip to content

Commit

Permalink
Fix detection whether we're running from the macOS menu bar item or not.
Browse files Browse the repository at this point in the history
Simplify the update folder cleanup.
  • Loading branch information
michaelherger committed Jan 5, 2025
1 parent 75472a0 commit 8f4a607
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions Slim/Utils/OS/OSX.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ use File::Spec::Functions qw(:ALL);
use FindBin qw($Bin);
use POSIX qw(LC_CTYPE LC_TIME);

# the new menubar item comes as an application in something like "Lyrion Music Server.app/Contents/Resources/server"
use constant IS_MENUBAR_ITEM => $Bin =~ m|app/Contents/Resources/server| ? 1 : 0;
# the new menubar item comes as an application in something like "Lyrion Music Server.app/Contents/MacOS"
use constant IS_MENUBAR_ITEM => $Bin =~ m|app/Contents/| ? 1 : 0;
use constant CHECK_MENUBAR_ITEM_DURATION => 30;

my $canFollowAlias;
Expand Down Expand Up @@ -475,17 +475,9 @@ sub installerExtension {
my $updateFolder = $_[0]->dirsFor('updates');

# remove installer from old installation
Slim::Utils::Misc::deleteFiles($updateFolder, qr/^LogitechMediaServer.*\.pkg$/i);
Slim::Utils::Misc::deleteFiles($updateFolder, qr/^L.*M.*Server.*\.(pkg|zip)$/i);

if (IS_MENUBAR_ITEM) {
# remove pref pane installer
Slim::Utils::Misc::deleteFiles($updateFolder, qr/^LyrionMusicServer.*\.pkg$/i);
return 'dmg';
};

# remove menu bar item installer
Slim::Utils::Misc::deleteFiles($updateFolder, qr/^LyrionMusicServer.*\.zip$/i);
return 'pkg';
return 'dmg';
};

sub installerOS { IS_MENUBAR_ITEM ? 'macos' : 'osx' }
Expand Down

0 comments on commit 8f4a607

Please sign in to comment.