Skip to content

Commit

Permalink
Update Pizzaiolo.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
vertexgamer authored May 2, 2022
1 parent 0b1e2e5 commit 2ba6639
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions Pizzaiolo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ int operai;
string percorso;
int i;
int loop = 0;
string cartellaoutput;
int z;

int main()
{
Expand All @@ -39,24 +41,39 @@ int main()
getline(std::cin, argomenti);
cout << "Trascina la cartella con i files (il path non deve avere spazi) / Drag the folder containing the files (the path mustn't have spaces)" << endl; //the user drag the folder which contains the files to be encoded
getline(std::cin, cartella);
cout << "Desideri che l'output vada su una cartella specifica? Se no, lascia il campo vuoto" << endl;
getline(std::cin, cartellaoutput);
cout << "Inserisci quante istanze saranno attive simultaneamente (USA UN VALORE MAGGIORE DI 0) / Insert the number of instances allowed at the same time (THE VALUE MUST BE GREATER THAN 0)" << endl;
cin >> operai; //number of simultaneus instances
argomentioriginale = argomenti;

i = eseguibile.find_last_of("\\"); //the executable name is extracted from the path given before
nomeeseguibile = eseguibile.substr(i + 1);

for (const auto& entry : fs::directory_iterator(cartella)) { //it gets the path of the files inside the folder
for (const auto& entry : fs::recursive_directory_iterator(cartella)) { //it gets the path of the files inside the folder
percorso = entry.path().string();

while (argomenti.find("perin") != string::npos)
argomenti.replace(argomenti.find("perin"), 5, percorso); //it replace "percorso" with the file path

percorso = percorso.substr(0, percorso.find(".", 0));

while (argomenti.find("perout") != string::npos)
argomenti.replace(argomenti.find("perout"), 6, percorso);
if (cartellaoutput.empty())
{

while (argomenti.find("perout") != string::npos)
argomenti.replace(argomenti.find("perout"), 6, percorso);
}
else
{
z = percorso.find_last_of("\\");
percorso = percorso.substr(z + 1);
percorso = cartellaoutput + "\\" + percorso;
cout << percorso << endl;
while (argomenti.find("perout") != string::npos)
argomenti.replace(argomenti.find("perout"), 6, percorso);
}

cout << "start " + eseguibile + " " + argomenti << endl; //it cout the result for debugging purposes, in the final version it will start the process
system(("start " + eseguibile + " " + argomenti).c_str());
argomenti = argomentioriginale;
Expand Down

0 comments on commit 2ba6639

Please sign in to comment.