@@ -33,10 +33,18 @@ MainWindow::MainWindow(const File& fileToLoad)
3333 Colour(Colours::black),
3434 DocumentWindow::allButtons)
3535{
36-
37- File activityLog = File::getCurrentWorkingDirectory ().getChildFile (" activity.log" );
36+ configsDir = CoreServices::getSavedStateDirectory ();
37+ if (!configsDir.getFullPathName ().contains (" plugin-GUI" + File::getSeparatorString () + " Build" ))
38+ configsDir = configsDir.getChildFile (" configs-api" + String (PLUGIN_API_VER));
39+
40+ if (!configsDir.isDirectory ())
41+ configsDir.createDirectory ();
42+
43+ File activityLog = configsDir.getChildFile (" activity.log" );
3844 if (activityLog.exists ())
3945 activityLog.deleteFile ();
46+
47+ OELogger::instance ().createLogFile (activityLog.getFullPathName ().toStdString ());
4048
4149 std::cout << " Session Start Time: " << Time::getCurrentTime ().toString (true , true , true , true ) << std::endl;
4250 std::cout << std::endl;
@@ -53,13 +61,6 @@ MainWindow::MainWindow(const File& fileToLoad)
5361 shouldEnableHttpServer = true ;
5462 openDefaultConfigWindow = false ;
5563
56- configsDir = CoreServices::getSavedStateDirectory ();
57- if (!configsDir.getFullPathName ().contains (" plugin-GUI" + File::getSeparatorString () + " Build" ))
58- configsDir = configsDir.getChildFile (" configs-api" + String (PLUGIN_API_VER));
59-
60- if (!configsDir.isDirectory ())
61- configsDir.createDirectory ();
62-
6364 // Create ProcessorGraph and AudioComponent, and connect them.
6465 // Callbacks will be set by the play button in the control panel
6566
@@ -229,9 +230,13 @@ void MainWindow::handleCrash(void* input)
229230 LOGD (" \n " , backtrace);
230231 std::flush (std::cout);
231232
232- File activityLog = File::getCurrentWorkingDirectory ().getChildFile (" activity.log" );
233+ File crashLogDir = CoreServices::getSavedStateDirectory ();
234+ if (!crashLogDir.getFullPathName ().contains (" plugin-GUI" + File::getSeparatorString () + " Build" ))
235+ crashLogDir = crashLogDir.getChildFile (" configs-api" + String (PLUGIN_API_VER));
236+
237+ File activityLog = crashLogDir.getChildFile (" activity.log" );
233238 String dt = AccessClass::getControlPanel ()->generateDatetimeFromFormat (" MM-DD-YYYY_HH_MM_SS" );
234- File crashLog = File::getCurrentWorkingDirectory () .getChildFile (" activity_" + dt + " .log" );
239+ File crashLog = crashLogDir .getChildFile (" activity_" + dt + " .log" );
235240
236241 if (activityLog.exists ())
237242 {
@@ -240,7 +245,7 @@ void MainWindow::handleCrash(void* input)
240245 activityLog.deleteFile ();
241246 }
242247
243- String recoveryFileLocation = CoreServices::getSavedStateDirectory () .getChildFile (" recoveryConfig.xml" ).getFullPathName ();
248+ String recoveryFileLocation = crashLogDir .getChildFile (" recoveryConfig.xml" ).getFullPathName ();
244249
245250 AlertWindow::showMessageBox (AlertWindow::NoIcon,
246251 " Open Ephys has stopped working" ,
0 commit comments