diff --git a/Source/StudyFrameworkPlugin/Private/SFParticipant.cpp b/Source/StudyFrameworkPlugin/Private/SFParticipant.cpp index b5677172c4371048d1282dbbfd070cbf773ca703..c6fc0c8617dff89201e18623a97f96eaeec37677 100644 --- a/Source/StudyFrameworkPlugin/Private/SFParticipant.cpp +++ b/Source/StudyFrameworkPlugin/Private/SFParticipant.cpp @@ -705,6 +705,8 @@ void USFParticipant::CreateLongTableBackUp(const FString PathToSrcFile) const void USFParticipant::ClearLogData(ASFStudySetup* StudySetup) { const FString LongTableFolder = FPaths::ProjectDir() + "StudyFramework/StudyLogs/"; + const FString StudyRunsFolder = FPaths::ProjectDir() + "StudyFramework/StudyRuns"; + const FString RecyclingBinFolder = FPaths::ProjectDir() + "StudyFramework/RecyclingBin/"; const FString Extension = "*.csv"; const FString SearchPattern = LongTableFolder + Extension; const TArray<FString> LogSubfolders = {"ParticipantLogs", "GazeTrackingLogs", "PositionLogs"}; @@ -712,20 +714,24 @@ void USFParticipant::ClearLogData(ASFStudySetup* StudySetup) IFileManager& FileManager = IFileManager::Get(); FileManager.FindFiles(FileNames, *SearchPattern, true, false); //Instead of actually deleting files, we want to move them to a recycling bin folder, to minimize risk of data loss - FString NewParentFolderPath = LongTableFolder + "RecyclingBin/" + "RestartStudyBackup-" + FDateTime::Now().ToString() + "/"; + FString NewParentFolderPath = RecyclingBinFolder + "RestartStudyBackup-" + FDateTime::Now().ToString() + "/"; //Move PhaseTables (.csv-files) for (FString Filename : FileNames) { const FString FullName = LongTableFolder + Filename; - FileManager.Move(*(NewParentFolderPath + Filename), *FullName); + FileManager.Move(*(NewParentFolderPath + "StudyLogs/" + Filename), *FullName); } //Move execution-based log folders (PositionLogs, etc.) for (FString Subfolder : LogSubfolders) { const FString FullName = LongTableFolder + Subfolder; if (FileManager.DirectoryExists(*FullName)) { - FileManager.Move(*(NewParentFolderPath + Subfolder), *FullName); + FileManager.Move(*(NewParentFolderPath + "StudyLogs/" + Subfolder), *FullName); } } + //Move StudyFramework/StudyRuns folder + if (FileManager.DirectoryExists(*StudyRunsFolder)) { + FileManager.Move(*(NewParentFolderPath + "StudyRuns"), *StudyRunsFolder); + } FSFLoggingUtils::Log("Moved .csv files: " + NewParentFolderPath); }