From 2e287f44962a8519227655727149920699185771 Mon Sep 17 00:00:00 2001 From: "Ryan@SOLARIS_testStation" Date: Mon, 1 Jul 2024 17:56:03 -0400 Subject: [PATCH] [Major] fully tested new folder arrangement. the programSettings.txt will be saved on current directory, can run without analysis path --- mainwindow.cpp | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 68d497f..a7a29c5 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -2030,6 +2030,10 @@ void MainWindow::CreateNewExperiment(const QString newExpName){ runID = -1; elogID = 0; + expDataPath = masterExpDataPath + "/" + expName; + rawDataPath = expDataPath + "/data_raw/"; + rootDataPath = expDataPath + "/root_data/"; + CreateRawDataFolder(); WriteExpNameSh(); @@ -2051,6 +2055,19 @@ void MainWindow::CreateNewExperiment(const QString newExpName){ } } + //check if .gitignore exist + QFile gitIgnore(analysisPath + "/.gitignore"); + if( !gitIgnore.exists() ) { + if( gitIgnore.open(QIODevice::Text | QIODevice::WriteOnly) ){ + gitIgnore.write("data_raw\n"); + gitIgnore.write("root_data\n"); + gitIgnore.write("*.root\n"); + gitIgnore.write("*.d\n"); + gitIgnore.write("*.so\n"); + gitIgnore.close(); + } + } + //----- create git branch if( useGit ){ QProcess git; @@ -2127,7 +2144,13 @@ void MainWindow::ChangeExperiment(const QString newExpName){ LogMsg("============================================="); LogMsg("Swicted to branch : " + expName + ""); + expDataPath = masterExpDataPath + "/" + newExpName; + rawDataPath = expDataPath + "/data_raw/"; + rootDataPath = expDataPath + "/root_data/"; + CreateRawDataFolder(); + CreateDataSymbolicLink(); + SaveProgramSettings(); LoadExpNameSh(); if( influx ){ @@ -2144,7 +2167,7 @@ void MainWindow::CreateRawDataFolder(){ //----- create data folder QDir dir(rawDataPath); if( !dir.exists()){ - if( dir.mkdir(rawDataPath)){ + if( dir.mkpath(rawDataPath)){ LogMsg("Created folder " + rawDataPath + " for storing raw data." ); }else{ LogMsg("" + rawDataPath + " cannot be created. Access right problem? " ); @@ -2156,7 +2179,7 @@ void MainWindow::CreateRawDataFolder(){ //----- create root data folder QDir rootDir(rootDataPath); if( !rootDir.exists()) { - if( rootDir.mkdir(rootDataPath) ){ + if( rootDir.mkpath(rootDataPath) ){ LogMsg("Created folder " + rootDataPath + " for storing root files."); }else{ LogMsg("" + rootDataPath + " cannot be created. Access right problem? " ); @@ -2168,7 +2191,7 @@ void MainWindow::CreateRawDataFolder(){ //----- create analysis Folder QDir anaDir; if( !anaDir.exists(analysisPath)){ - if( anaDir.mkdir(analysisPath)){ + if( anaDir.mkpath(analysisPath)){ LogMsg("" + analysisPath + " created." ); }else{ LogMsg("" + analysisPath + " cannot be created. Access right problem?" );