Skip to content

Commit be5c2e4

Browse files
authored
Merge pull request #374 from anjaldoshi/patch/shared-directory
Change plugin and shared directory location depending on GUI build type
2 parents d702d5c + 3a22ce1 commit be5c2e4

File tree

7 files changed

+52
-36
lines changed

7 files changed

+52
-36
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#Open Ephys GUI main build file
22
cmake_minimum_required(VERSION 3.5.0)
33

4-
set(GUI_VERSION 0.5.0)
4+
set(GUI_VERSION 0.5.1)
55

66
string(REGEX MATCHALL "[0-9]+" VERSION_LIST ${GUI_VERSION})
77
set(GUI_VERSION_HEX "0x")

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ Our primary user base is scientists performing electrophysiology experiments wit
3232

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

35-
- [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)
36-
- [Ubuntu/Debian](https://dl.bintray.com/open-ephys-gui/Release-Installer/open-ephys-gui-v0.5.0.deb)
37-
- [macOS](https://dl.bintray.com/open-ephys-gui/Release-Installer/Open_Ephys_GUI_v0.5.0.dmg)
35+
- [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)
36+
- [Ubuntu/Debian](https://dl.bintray.com/open-ephys-gui/Release-Installer/open-ephys-gui-v0.5.1.deb)
37+
- [macOS](https://dl.bintray.com/open-ephys-gui/Release-Installer/Open_Ephys_GUI_v0.5.1.dmg)
3838

39-
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).
39+
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).
4040

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

Resources/Installers/Linux/Open-Ephys_Installer/DEBIAN/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: open-ephys
2-
Version: 0.5.0
2+
Version: 0.5.1
33
Architecture: amd64
44
Installed-Size: 18644
55
Section: science

Resources/Installers/Windows/windows_installer_script.iss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[Setup]
22
AppName=Open Ephys
3-
AppVersion=0.5.0
4-
AppVerName=Open Ephys 0.5.0
3+
AppVersion=0.5.1
4+
AppVerName=Open Ephys 0.5.1
55
AppPublisher=open-ephys.org
66
AppPublisherURL=https://open-ephys.org/gui
77
DefaultDirName={autopf}\Open Ephys
@@ -23,6 +23,7 @@ Name: install_usb; Description: "Install Opal Kelly Front Panel USB driver for O
2323

2424
[Files]
2525
Source: "..\..\..\Build\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs; BeforeInstall: UpdateProgress(0);
26+
Source: "..\..\..\Build\Release\shared\*"; DestDir: "{commonappdata}\Open Ephys\shared"; Flags: ignoreversion recursesubdirs; BeforeInstall: UpdateProgress(55);
2627
Source: "..\..\DataFiles\*"; DestDir: "{userdocs}\Open Ephys\DataFiles"; Flags: ignoreversion recursesubdirs; BeforeInstall: UpdateProgress(60);
2728
Source: "vcredist_x64.exe"; DestDir: {tmp}; Flags: deleteafterinstall; BeforeInstall: UpdateProgress(70);
2829
Source: "..\..\DLLs\FrontPanelUSB-DriverOnly-4.5.5.exe"; DestDir: {tmp}; Flags: deleteafterinstall; BeforeInstall: UpdateProgress(90);

Source/CoreServices.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,19 @@ namespace CoreServices
245245
#if defined(__APPLE__)
246246
File dir = File::getSpecialLocation(File::userApplicationDataDirectory).getChildFile("Application Support/open-ephys");
247247
#elif _WIN32
248-
File dir = File::getSpecialLocation(File::commonApplicationDataDirectory).getChildFile("Open Ephys");
248+
String appDir = File::getSpecialLocation(File::currentApplicationFile).getFullPathName();
249+
File dir;
250+
if(appDir.contains("plugin-GUI\\Build\\"))
251+
dir = File::getSpecialLocation(File::currentApplicationFile).getParentDirectory();
252+
else
253+
dir = File::getSpecialLocation(File::commonApplicationDataDirectory).getChildFile("Open Ephys");
249254
#else
250-
File dir = File::getSpecialLocation(File::userApplicationDataDirectory).getChildFile(".open-ephys");;
255+
String appDir = File::getSpecialLocation(File::currentApplicationFile).getFullPathName();
256+
File dir;
257+
if(appDir.contains("plugin-GUI/Build/"))
258+
dir = File::getSpecialLocation(File::currentApplicationFile).getParentDirectory();
259+
else
260+
dir = File::getSpecialLocation(File::userApplicationDataDirectory).getChildFile(".open-ephys");;
251261
#endif
252262
if (!dir.isDirectory()) {
253263
dir.createDirectory();

Source/Processors/PluginManager/PluginManager.cpp

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,29 @@ static void errorMsg(const char *file, int line, const char *msg) {
7272

7373
PluginManager::PluginManager()
7474
{
75-
#ifdef WIN32
75+
#ifdef _WIN32
76+
77+
String appDir = File::getSpecialLocation(File::currentApplicationFile).getFullPathName();
78+
7679
//Shared directory at the same level as executable
7780
File sharedPath = File::getSpecialLocation(File::currentApplicationFile).getParentDirectory().getChildFile("shared");
78-
SetDllDirectory(sharedPath.getFullPathName().toUTF8());
79-
8081
//Shared directory managed by Plugin Installer at C:/ProgramData
8182
File installSharedPath = File::getSpecialLocation(File::commonApplicationDataDirectory).getChildFile("Open Ephys/shared");
82-
if (!installSharedPath.isDirectory()) {
83-
installSharedPath.createDirectory();
83+
84+
if(appDir.contains("plugin-GUI\\Build\\"))
85+
{
86+
SetDllDirectory(sharedPath.getFullPathName().toUTF8());
87+
}
88+
else
89+
{
90+
if (!installSharedPath.isDirectory())
91+
{
92+
std::cout << "Copying shared dependencies to " << installSharedPath.getFullPathName() << std::endl;
93+
sharedPath.copyDirectoryTo(installSharedPath);
94+
}
95+
SetDllDirectory(installSharedPath.getFullPathName().toUTF8());
8496
}
8597

86-
AddDllDirectory(installSharedPath.getFullPathName().toWideCharPointer());
87-
SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
8898
#elif __linux__
8999
File installSharedPath = File::getSpecialLocation(File::userApplicationDataDirectory).getChildFile(".open-ephys/shared");
90100
if (!installSharedPath.isDirectory()) {
@@ -107,10 +117,16 @@ void PluginManager::loadAllPlugins()
107117
paths.add(File::getSpecialLocation(File::userApplicationDataDirectory).getChildFile("Application Support/open-ephys/plugins"));
108118
#elif _WIN32
109119
paths.add(File::getSpecialLocation(File::currentApplicationFile).getParentDirectory().getChildFile("plugins"));
110-
paths.add(File::getSpecialLocation(File::commonApplicationDataDirectory).getChildFile("Open Ephys/plugins"));
120+
121+
String appDir = File::getSpecialLocation(File::currentApplicationFile).getFullPathName();
122+
if(!appDir.contains("plugin-GUI\\Build\\"))
123+
paths.add(File::getSpecialLocation(File::commonApplicationDataDirectory).getChildFile("Open Ephys/plugins"));
111124
#else
112125
paths.add(File::getSpecialLocation(File::currentApplicationFile).getParentDirectory().getChildFile("plugins"));
113-
paths.add(File::getSpecialLocation(File::userApplicationDataDirectory).getChildFile(".open-ephys/plugins"));
126+
127+
String appDir = File::getSpecialLocation(File::currentApplicationFile).getFullPathName();
128+
if(!appDir.contains("plugin-GUI/Build/"))
129+
paths.add(File::getSpecialLocation(File::userApplicationDataDirectory).getChildFile(".open-ephys/plugins"));
114130
#endif
115131

116132
for (auto &pluginPath : paths) {

Source/UI/PluginInstaller.cpp

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,6 @@
3737

3838
//-----------------------------------------------------------------------
3939

40-
static inline File getPluginsLocationDirectory() {
41-
#if defined(__APPLE__)
42-
File dir = File::getSpecialLocation(File::userApplicationDataDirectory).getChildFile("Application Support/open-ephys");
43-
#elif _WIN32
44-
File dir = File::getSpecialLocation(File::commonApplicationDataDirectory).getChildFile("Open Ephys");
45-
#else
46-
File dir = File::getSpecialLocation(File::userApplicationDataDirectory).getChildFile(".open-ephys");
47-
#endif
48-
return std::move(dir);
49-
}
50-
5140
static String osType;
5241

5342
PluginInstaller::PluginInstaller(MainWindow* mainWindow)
@@ -108,12 +97,12 @@ void PluginInstaller::closeButtonPressed()
10897

10998
void PluginInstaller::createXmlFile()
11099
{
111-
File pluginsDir = getPluginsLocationDirectory().getChildFile("plugins");
100+
File pluginsDir = CoreServices::getSavedStateDirectory().getChildFile("plugins");
112101
if (!pluginsDir.isDirectory())
113102
pluginsDir.createDirectory();
114103

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

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

140129
forEachXmlChildElement(*child, e)
141130
{
142-
File pluginPath = getPluginsLocationDirectory().getChildFile(baseStr + e->getAttributeValue(1));
131+
File pluginPath = CoreServices::getSavedStateDirectory().getChildFile(baseStr + e->getAttributeValue(1));
143132
if (!pluginPath.exists())
144133
elementsToRemove.add(e);
145134
}
@@ -341,7 +330,7 @@ void PluginInstallerComponent::comboBoxChanged(ComboBox* comboBoxThatHasChanged)
341330
void PluginInstallerComponent::run()
342331
{
343332
String fileStr = "plugins" + File::separatorString + "installedPlugins.xml";
344-
File xmlFile = getPluginsLocationDirectory().getChildFile(fileStr);
333+
File xmlFile = CoreServices::getSavedStateDirectory().getChildFile(fileStr);
345334

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

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

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

11131102
//Get path to plugins directory
1114-
File pluginsPath = getPluginsLocationDirectory();
1103+
File pluginsPath = CoreServices::getSavedStateDirectory();
11151104

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

0 commit comments

Comments
 (0)