Skip to content

Commit

Permalink
Merge pull request #374 from anjaldoshi/patch/shared-directory
Browse files Browse the repository at this point in the history
 Change plugin and shared directory location depending on GUI build type
  • Loading branch information
medengineer authored Sep 30, 2020
2 parents d702d5c + 3a22ce1 commit be5c2e4
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 36 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#Open Ephys GUI main build file
cmake_minimum_required(VERSION 3.5.0)

set(GUI_VERSION 0.5.0)
set(GUI_VERSION 0.5.1)

string(REGEX MATCHALL "[0-9]+" VERSION_LIST ${GUI_VERSION})
set(GUI_VERSION_HEX "0x")
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ Our primary user base is scientists performing electrophysiology experiments wit

The easiest way to get started is to download the installer for your platform of choice:

- [Windows](https://dl.bintray.com/open-ephys-gui/Release-Installer/Install-Open-Ephys-GUI-v0.5.0.exe) (Neuropixels plugins available via File > Plugin Installer)
- [Ubuntu/Debian](https://dl.bintray.com/open-ephys-gui/Release-Installer/open-ephys-gui-v0.5.0.deb)
- [macOS](https://dl.bintray.com/open-ephys-gui/Release-Installer/Open_Ephys_GUI_v0.5.0.dmg)
- [Windows](https://dl.bintray.com/open-ephys-gui/Release-Installer/Install-Open-Ephys-GUI-v0.5.1.exe) (Neuropixels plugins available via File -> Plugin Installer)
- [Ubuntu/Debian](https://dl.bintray.com/open-ephys-gui/Release-Installer/open-ephys-gui-v0.5.1.deb)
- [macOS](https://dl.bintray.com/open-ephys-gui/Release-Installer/Open_Ephys_GUI_v0.5.1.dmg)

It’s also possible to obtain the binaries as a .zip file for [Windows](https://dl.bintray.com/open-ephys-gui/Release/open-ephys-v0.5.0-windows.zip), [Linux](https://dl.bintray.com/open-ephys-gui/Release/open-ephys-v0.5.0-linux.zip), or [Mac](https://dl.bintray.com/open-ephys-gui/Release/open-ephys-v0.5.0-mac.zip).
It’s also possible to obtain the binaries as a .zip file for [Windows](https://dl.bintray.com/open-ephys-gui/Release/open-ephys-v0.5.1-windows.zip), [Linux](https://dl.bintray.com/open-ephys-gui/Release/open-ephys-v0.5.1-linux.zip), or [Mac](https://dl.bintray.com/open-ephys-gui/Release/open-ephys-v0.5.1-mac.zip).

Detailed installation instructions can be found [here](https://open-ephys.github.io/gui-docs/User-Manual/Installing-the-GUI.html).

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: open-ephys
Version: 0.5.0
Version: 0.5.1
Architecture: amd64
Installed-Size: 18644
Section: science
Expand Down
5 changes: 3 additions & 2 deletions Resources/Installers/Windows/windows_installer_script.iss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Setup]
AppName=Open Ephys
AppVersion=0.5.0
AppVerName=Open Ephys 0.5.0
AppVersion=0.5.1
AppVerName=Open Ephys 0.5.1
AppPublisher=open-ephys.org
AppPublisherURL=https://open-ephys.org/gui
DefaultDirName={autopf}\Open Ephys
Expand All @@ -23,6 +23,7 @@ Name: install_usb; Description: "Install Opal Kelly Front Panel USB driver for O

[Files]
Source: "..\..\..\Build\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs; BeforeInstall: UpdateProgress(0);
Source: "..\..\..\Build\Release\shared\*"; DestDir: "{commonappdata}\Open Ephys\shared"; Flags: ignoreversion recursesubdirs; BeforeInstall: UpdateProgress(55);
Source: "..\..\DataFiles\*"; DestDir: "{userdocs}\Open Ephys\DataFiles"; Flags: ignoreversion recursesubdirs; BeforeInstall: UpdateProgress(60);
Source: "vcredist_x64.exe"; DestDir: {tmp}; Flags: deleteafterinstall; BeforeInstall: UpdateProgress(70);
Source: "..\..\DLLs\FrontPanelUSB-DriverOnly-4.5.5.exe"; DestDir: {tmp}; Flags: deleteafterinstall; BeforeInstall: UpdateProgress(90);
Expand Down
14 changes: 12 additions & 2 deletions Source/CoreServices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,19 @@ namespace CoreServices
#if defined(__APPLE__)
File dir = File::getSpecialLocation(File::userApplicationDataDirectory).getChildFile("Application Support/open-ephys");
#elif _WIN32
File dir = File::getSpecialLocation(File::commonApplicationDataDirectory).getChildFile("Open Ephys");
String appDir = File::getSpecialLocation(File::currentApplicationFile).getFullPathName();
File dir;
if(appDir.contains("plugin-GUI\\Build\\"))
dir = File::getSpecialLocation(File::currentApplicationFile).getParentDirectory();
else
dir = File::getSpecialLocation(File::commonApplicationDataDirectory).getChildFile("Open Ephys");
#else
File dir = File::getSpecialLocation(File::userApplicationDataDirectory).getChildFile(".open-ephys");;
String appDir = File::getSpecialLocation(File::currentApplicationFile).getFullPathName();
File dir;
if(appDir.contains("plugin-GUI/Build/"))
dir = File::getSpecialLocation(File::currentApplicationFile).getParentDirectory();
else
dir = File::getSpecialLocation(File::userApplicationDataDirectory).getChildFile(".open-ephys");;
#endif
if (!dir.isDirectory()) {
dir.createDirectory();
Expand Down
34 changes: 25 additions & 9 deletions Source/Processors/PluginManager/PluginManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,29 @@ static void errorMsg(const char *file, int line, const char *msg) {

PluginManager::PluginManager()
{
#ifdef WIN32
#ifdef _WIN32

String appDir = File::getSpecialLocation(File::currentApplicationFile).getFullPathName();

//Shared directory at the same level as executable
File sharedPath = File::getSpecialLocation(File::currentApplicationFile).getParentDirectory().getChildFile("shared");
SetDllDirectory(sharedPath.getFullPathName().toUTF8());

//Shared directory managed by Plugin Installer at C:/ProgramData
File installSharedPath = File::getSpecialLocation(File::commonApplicationDataDirectory).getChildFile("Open Ephys/shared");
if (!installSharedPath.isDirectory()) {
installSharedPath.createDirectory();

if(appDir.contains("plugin-GUI\\Build\\"))
{
SetDllDirectory(sharedPath.getFullPathName().toUTF8());
}
else
{
if (!installSharedPath.isDirectory())
{
std::cout << "Copying shared dependencies to " << installSharedPath.getFullPathName() << std::endl;
sharedPath.copyDirectoryTo(installSharedPath);
}
SetDllDirectory(installSharedPath.getFullPathName().toUTF8());
}

AddDllDirectory(installSharedPath.getFullPathName().toWideCharPointer());
SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
#elif __linux__
File installSharedPath = File::getSpecialLocation(File::userApplicationDataDirectory).getChildFile(".open-ephys/shared");
if (!installSharedPath.isDirectory()) {
Expand All @@ -107,10 +117,16 @@ void PluginManager::loadAllPlugins()
paths.add(File::getSpecialLocation(File::userApplicationDataDirectory).getChildFile("Application Support/open-ephys/plugins"));
#elif _WIN32
paths.add(File::getSpecialLocation(File::currentApplicationFile).getParentDirectory().getChildFile("plugins"));
paths.add(File::getSpecialLocation(File::commonApplicationDataDirectory).getChildFile("Open Ephys/plugins"));

String appDir = File::getSpecialLocation(File::currentApplicationFile).getFullPathName();
if(!appDir.contains("plugin-GUI\\Build\\"))
paths.add(File::getSpecialLocation(File::commonApplicationDataDirectory).getChildFile("Open Ephys/plugins"));
#else
paths.add(File::getSpecialLocation(File::currentApplicationFile).getParentDirectory().getChildFile("plugins"));
paths.add(File::getSpecialLocation(File::userApplicationDataDirectory).getChildFile(".open-ephys/plugins"));

String appDir = File::getSpecialLocation(File::currentApplicationFile).getFullPathName();
if(!appDir.contains("plugin-GUI/Build/"))
paths.add(File::getSpecialLocation(File::userApplicationDataDirectory).getChildFile(".open-ephys/plugins"));
#endif

for (auto &pluginPath : paths) {
Expand Down
23 changes: 6 additions & 17 deletions Source/UI/PluginInstaller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,6 @@

//-----------------------------------------------------------------------

static inline File getPluginsLocationDirectory() {
#if defined(__APPLE__)
File dir = File::getSpecialLocation(File::userApplicationDataDirectory).getChildFile("Application Support/open-ephys");
#elif _WIN32
File dir = File::getSpecialLocation(File::commonApplicationDataDirectory).getChildFile("Open Ephys");
#else
File dir = File::getSpecialLocation(File::userApplicationDataDirectory).getChildFile(".open-ephys");
#endif
return std::move(dir);
}

static String osType;

PluginInstaller::PluginInstaller(MainWindow* mainWindow)
Expand Down Expand Up @@ -108,12 +97,12 @@ void PluginInstaller::closeButtonPressed()

void PluginInstaller::createXmlFile()
{
File pluginsDir = getPluginsLocationDirectory().getChildFile("plugins");
File pluginsDir = CoreServices::getSavedStateDirectory().getChildFile("plugins");
if (!pluginsDir.isDirectory())
pluginsDir.createDirectory();

String xmlFile = "plugins" + File::separatorString + "installedPlugins.xml";
File file = getPluginsLocationDirectory().getChildFile(xmlFile);
File file = CoreServices::getSavedStateDirectory().getChildFile(xmlFile);

XmlDocument doc(file);
std::unique_ptr<XmlElement> xml (doc.getDocumentElement());
Expand All @@ -139,7 +128,7 @@ void PluginInstaller::createXmlFile()

forEachXmlChildElement(*child, e)
{
File pluginPath = getPluginsLocationDirectory().getChildFile(baseStr + e->getAttributeValue(1));
File pluginPath = CoreServices::getSavedStateDirectory().getChildFile(baseStr + e->getAttributeValue(1));
if (!pluginPath.exists())
elementsToRemove.add(e);
}
Expand Down Expand Up @@ -341,7 +330,7 @@ void PluginInstallerComponent::comboBoxChanged(ComboBox* comboBoxThatHasChanged)
void PluginInstallerComponent::run()
{
String fileStr = "plugins" + File::separatorString + "installedPlugins.xml";
File xmlFile = getPluginsLocationDirectory().getChildFile(fileStr);
File xmlFile = CoreServices::getSavedStateDirectory().getChildFile(fileStr);

XmlDocument doc(xmlFile);
std::unique_ptr<XmlElement> xml (doc.getDocumentElement());
Expand Down Expand Up @@ -665,7 +654,7 @@ bool PluginListBoxComponent::loadPluginInfo(const String& pluginName)

// If the plugin is already installed, get installed version number
String fileStr = "plugins" + File::separatorString + "installedPlugins.xml";
File xmlFile = getPluginsLocationDirectory().getChildFile(fileStr);
File xmlFile = CoreServices::getSavedStateDirectory().getChildFile(fileStr);

XmlDocument doc(xmlFile);
std::unique_ptr<XmlElement> xml (doc.getDocumentElement());
Expand Down Expand Up @@ -1111,7 +1100,7 @@ int PluginInfoComponent::downloadPlugin(const String& plugin, const String& vers
return 0;

//Get path to plugins directory
File pluginsPath = getPluginsLocationDirectory();
File pluginsPath = CoreServices::getSavedStateDirectory();

//Construct path for downloaded zip file
String pluginFilePath = pluginsPath.getFullPathName();
Expand Down

0 comments on commit be5c2e4

Please sign in to comment.