Skip to content
Snippets Groups Projects
Commit 4c75f55a authored by Matus Balogh's avatar Matus Balogh
Browse files

working version

parent ead8f95f
No related branches found
No related tags found
No related merge requests found
bla
bla
bla
bla
......@@ -8,10 +8,11 @@
#include <dirent.h>
#include <unistd.h>
#ifndef PROJECT_FOLDER
#define PROJECT_FOLDER "undefined"
#ifndef PROJECT_NAME
#define PROJECT_NAME "UNDEF_PROJECT"
#endif
//terminal colors
#define RESET "\033[0m"
#define BLACK "\033[30m" /* Black */
......@@ -63,8 +64,8 @@ string GetMachineID()
getline(machineIdFile, id);
cout << BOLDGREEN << "This machine ID is: " << RESET << GREEN << id << RESET << endl;
}
else
} else
{
id = "NULL";
cout << BOLDYELLOW << "Machine ID was not identified, " << RESET << YELLOW << "value \"NULL\" will be used instead" << RESET<< endl;
......@@ -91,20 +92,21 @@ void processGit(string filename)
time(&curr_time);
curr_tm = localtime(&curr_time);
char nf[100];
strftime(nf, 100, "caenSC_%e-%m-%Y_%Hh%Mm%Ss", curr_tm);
string oldname = filename;
oldname.erase(filename.find(".json"),5);
strftime(nf, 100, "_%e-%m-%Y_%Hh%Mm%Ss", curr_tm);
string newfile = nf;
newfile += "__" + GetMachineID() + ".json";
newfile = oldname + newfile + "__" + GetMachineID() + ".json";
//we must pull the submodule first to ensure all is up to date
if (system("git -C ./caenslowcontrol_json pull > gitlog.txt") != 0)
{
ShowError(cmd);
ShowError("git -C ./caenslowcontrol_json pull > gitlog.txt");
return;
}
sleep(1);
//check if project folder exists
string path =PROJECT_FOLDER;
string path = PROJECT_NAME;
path = "./caenslowcontrol_json/" + path;
string cmd = "mkdir " + path;
if(!DirectoryExists(path.c_str())) system(cmd.c_str());
......@@ -118,7 +120,7 @@ void processGit(string filename)
}
//git add
path = PROJECT_FOLDER;
path = PROJECT_NAME;
cmd = "git -C ./caenslowcontrol_json add " + path + "/" + newfile + " >> gitlog.txt";
if (system(cmd.c_str()) != 0)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment