Skip to content

Commit 260908a

Browse files
committed
Change new plugin installation location on Windows
1 parent c9cb133 commit 260908a

3 files changed

Lines changed: 20 additions & 10 deletions

File tree

Source/MainWindow.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030
static inline File getSavedStateDirectory() {
3131
#if defined(__APPLE__)
3232
File dir = File::getSpecialLocation(File::userApplicationDataDirectory).getChildFile("Application Support/open-ephys");
33-
if (!dir.isDirectory()) {
33+
#else
34+
File dir = File::getSpecialLocation(File::commonApplicationDataDirectory).getChildFile("Open Ephys");
35+
#endif
36+
if (!dir.isDirectory()) {
3437
dir.createDirectory();
3538
}
3639
return std::move(dir);
37-
#else
38-
return File::getSpecialLocation(File::currentExecutableFile).getParentDirectory();
39-
#endif
4040
}
4141

4242
MainWindow::MainWindow(const File& fileToLoad)

Source/Processors/PluginManager/PluginManager.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,18 @@ static void errorMsg(const char *file, int line, const char *msg) {
7373
PluginManager::PluginManager()
7474
{
7575
#ifdef WIN32
76+
//Shared directory at the same level as executable
7677
File sharedPath = File::getSpecialLocation(File::currentApplicationFile).getParentDirectory().getChildFile("shared");
7778
SetDllDirectory(sharedPath.getFullPathName().toUTF8());
79+
80+
//Shared directory managed by Plugin Installer at C:/ProgramData
81+
File installSharedPath = File::getSpecialLocation(File::commonApplicationDataDirectory).getChildFile("Open Ephys/shared");
82+
if (!installSharedPath.isDirectory()) {
83+
installSharedPath.createDirectory();
84+
}
85+
86+
AddDllDirectory(installSharedPath.getFullPathName().toWideCharPointer());
87+
SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
7888
#endif
7989
}
8090

@@ -92,11 +102,14 @@ void PluginManager::loadAllPlugins()
92102
paths.add(File::getSpecialLocation(File::userApplicationDataDirectory).getChildFile("Application Support/open-ephys/plugins"));
93103
#else
94104
paths.add(File::getSpecialLocation(File::currentApplicationFile).getParentDirectory().getChildFile("plugins"));
105+
paths.add(File::getSpecialLocation(File::commonApplicationDataDirectory).getChildFile("Open Ephys/plugins"));
95106
#endif
96107

97108
for (auto &pluginPath : paths) {
98109
if (!pluginPath.isDirectory()) {
99-
std::cout << "Plugin path not found: " << pluginPath.getFullPathName() << std::endl;
110+
std::cout << "Plugin path not found: " << pluginPath.getFullPathName()
111+
<< "\nCreating new plugins directory..." << std::endl;
112+
pluginPath.createDirectory();
100113
} else {
101114
loadPlugins(pluginPath);
102115
}

Source/UI/PluginInstaller.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,10 @@
4040
static inline File getPluginsLocationDirectory() {
4141
#if defined(__APPLE__)
4242
File dir = File::getSpecialLocation(File::userApplicationDataDirectory).getChildFile("Application Support/open-ephys");
43-
if (!dir.isDirectory()) {
44-
dir.createDirectory();
45-
}
46-
return std::move(dir);
4743
#else
48-
return File::getSpecialLocation(File::currentExecutableFile).getParentDirectory();
44+
File dir = File::getSpecialLocation(File::commonApplicationDataDirectory).getChildFile("Open Ephys");
4945
#endif
46+
return std::move(dir);
5047
}
5148

5249
static String osType;

0 commit comments

Comments
 (0)