Skip to content

Commit ffa0549

Browse files
committed
Download the correct update binaries on Linux & MacOS
Auto updater now checks whether to download the .zip binaries or the installer depending on the installation type on Linux & Mac
1 parent 8589ead commit ffa0549

1 file changed

Lines changed: 35 additions & 8 deletions

File tree

Source/AutoUpdater.cpp

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,19 @@ void LatestVersionCheckerAndUpdater::run()
156156
{
157157
requiredFilename = "Install-Open-Ephys-GUI-" + versionString + ".exe";
158158
}
159+
#elif JUCE_LINUX
160+
File exeDir = File::getSpecialLocation(File::SpecialLocationType::currentExecutableFile).getParentDirectory();
161+
if(exeDir.getFullPathName().contains("/usr/local/bin"))
162+
{
163+
requiredFilename = "open-ephys-gui-" + versionString + ".deb";
164+
}
165+
#elif JUCE_MAC
166+
File exeDir = File::getSpecialLocation(File::SpecialLocationType::currentApplicationFile).getParentDirectory();
167+
File globalAppDir = File::getSpecialLocation(File::SpecialLocationType::globalApplicationsDirectory);
168+
if(exeDir.getFullPathName().contains(globalAppDir.getFullPathName()))
169+
{
170+
requiredFilename = "Open_Ephys_GUI_" + versionString + ".dmg";
171+
}
159172
#endif
160173

161174
for (auto& asset : parsedAssets)
@@ -200,8 +213,8 @@ class UpdateDialog : public Component
200213
releaseNotesEditor.setText (releaseNotes);
201214
addAndMakeVisible (releaseNotesEditor);
202215

203-
addAndMakeVisible (chooseButton);
204-
chooseButton.onClick = [this] { exitModalStateWithResult (1); };
216+
addAndMakeVisible (downloadButton);
217+
downloadButton.onClick = [this] { exitModalStateWithResult (1); };
205218

206219
addAndMakeVisible (cancelButton);
207220
cancelButton.onClick = [this]
@@ -239,7 +252,7 @@ class UpdateDialog : public Component
239252

240253
auto buttonBounds = b.removeFromBottom (60);
241254
buttonBounds.removeFromBottom (25);
242-
chooseButton.setBounds (buttonBounds.removeFromLeft (buttonBounds.getWidth() / 2).reduced (20, 0));
255+
downloadButton.setBounds (buttonBounds.removeFromLeft (buttonBounds.getWidth() / 2).reduced (20, 0));
243256
cancelButton.setBounds (buttonBounds.reduced (20, 0));
244257
dontAskAgainButton.setBounds (cancelButton.getBounds().withY (cancelButton.getBottom() + 5).withHeight (20));
245258

@@ -295,7 +308,7 @@ class UpdateDialog : public Component
295308

296309
Label titleLabel, contentLabel, releaseNotesLabel;
297310
TextEditor releaseNotesEditor;
298-
TextButton chooseButton { "Download" }, cancelButton { "Cancel" };
311+
TextButton downloadButton { "Download" }, cancelButton { "Cancel" };
299312
ToggleButton dontAskAgainButton { "Don't ask again" };
300313
std::unique_ptr<Drawable> juceIcon;
301314
juce::Rectangle<int> juceIconBounds { 10, 10, 64, 64 };
@@ -478,11 +491,25 @@ void LatestVersionCheckerAndUpdater::downloadAndInstall (const Asset& asset, con
478491
else
479492
#endif
480493
{
481-
String msgBoxString = "Please extract the zip file located at: \n" +
482-
targetFile.getFullPathName().quoted() +
483-
"\nto your desired location and then run the updated version from there. "
484-
"You can also overwrite the current installation after quitting the current instance.";
494+
String msgBoxString = String();
485495

496+
if(targetFile.getFileExtension().equalsIgnoreCase(".zip"))
497+
{
498+
msgBoxString = "Please extract the zip file located at: \n" +
499+
targetFile.getFullPathName().quoted() +
500+
"\nto your desired location and then run the updated version from there. "
501+
"You can also overwrite the current installation after quitting the current instance.";
502+
503+
}
504+
else
505+
{
506+
msgBoxString = "Please launch the installer file located at: \n" +
507+
targetFile.getFullPathName().quoted() +
508+
"\nafter closing the GUI, "
509+
"and follow the steps to finish updating the GUI.";
510+
}
511+
512+
486513
downloader.reset (new DownloadThread (asset, targetFile,
487514
[this, msgBoxString]
488515
{

0 commit comments

Comments
 (0)