From 1bcf33cb65518ef66a7394d4267907a2c33bb8b3 Mon Sep 17 00:00:00 2001 From: steve.greedy Date: Fri, 10 Aug 2018 14:01:01 +0100 Subject: [PATCH] Modifications to file path structure --- GUI/SW1/SRC/COAXIAL.cpp | 12 ++++++++---- GUI/SW1/SRC/CYLINDRICAL.cpp | 12 ++++++++---- GUI/SW1/SRC/DCONN.cpp | 14 ++++++++++---- GUI/SW1/SRC/FLEXCABLE.cpp | 13 +++++++++---- GUI/SW1/SRC/OVERSHIELD.cpp | 14 ++++++++++---- GUI/SW1/SRC/SPACEWIRE.cpp | 16 ++++++++++------ GUI/SW1/SRC/SW1_GUIMain.cpp | 4 +++- GUI/SW1/SRC/TP.cpp | 13 +++++++++---- GUI/SW1/SRC/TWINAX.cpp | 14 ++++++++++---- GUI/SW1/SRC/UTP.cpp | 14 ++++++++++---- 10 files changed, 87 insertions(+), 39 deletions(-) diff --git a/GUI/SW1/SRC/COAXIAL.cpp b/GUI/SW1/SRC/COAXIAL.cpp index b72e795..5079dfb 100644 --- a/GUI/SW1/SRC/COAXIAL.cpp +++ b/GUI/SW1/SRC/COAXIAL.cpp @@ -395,11 +395,14 @@ void COAXIAL::OnButton2Click(wxCommandEvent& event) wxString fileName = TextCtrl1->GetValue(); wxString command_line; + wxString separator(wxFileName::GetPathSeparator()); + std::stringstream stream; - stream << "cable_model_builder" + stream <<"." + separator + << "cable_model_builder" << " " - << "..\\" + MODname + "\\CABLE\\" + << ".." + separator + MODname + separator + "CABLE" + separator << fileName ; command_line << stream.str().c_str(); @@ -559,8 +562,9 @@ void COAXIAL::OnTextCtrl16Text(wxCommandEvent& event) void COAXIAL::WriteCableFile(wxString fileName) { ofstream cableFile; + wxString separator(wxFileName::GetPathSeparator()); - wxString fullFileName = pathToMOD + "/CABLE/" + fileName + ".cable_spec"; + wxString fullFileName = pathToMOD + separator + "CABLE" + separator + fileName + ".cable_spec"; cableFile.open (fullFileName); @@ -569,7 +573,7 @@ void COAXIAL::WriteCableFile(wxString fileName) // minimum requirements for type Coax cableFile <<"# MOD_cable_lib_dir \n"; - cableFile <<"../"<< MODname <<"/CABLE/"<<"\n"; + cableFile <<".." << separator << MODname << separator << "CABLE" << separator <<"\n"; cableFile <<"Coax\n"; cableFile <<"2 \t#number of conductors \n"; cableFile <<"6 \t#number of parameters \n"; diff --git a/GUI/SW1/SRC/CYLINDRICAL.cpp b/GUI/SW1/SRC/CYLINDRICAL.cpp index 0ff3a02..ddeac81 100644 --- a/GUI/SW1/SRC/CYLINDRICAL.cpp +++ b/GUI/SW1/SRC/CYLINDRICAL.cpp @@ -238,11 +238,14 @@ void CYLINDRICAL::OnButton2Click(wxCommandEvent& event) wxString fileName = TextCtrl1->GetValue(); wxString command_line; + wxString separator(wxFileName::GetPathSeparator()); + std::stringstream stream; - stream << "cable_model_builder" + stream <<"." + separator + << "cable_model_builder" << " " - << "..\\" + MODname + "\\CABLE\\" + << ".." + separator + MODname + separator + "CABLE" + separator << fileName ; command_line << stream.str().c_str(); @@ -326,8 +329,9 @@ void CYLINDRICAL::WriteCableFile (wxString fileName) { ofstream cableFile; + wxString separator(wxFileName::GetPathSeparator()); - wxString fullFileName = pathToMOD + "/CABLE/" + fileName + ".cable_spec"; + wxString fullFileName = pathToMOD + separator + "CABLE" + separator + fileName + ".cable_spec"; cableFile.open (fullFileName); @@ -335,7 +339,7 @@ void CYLINDRICAL::WriteCableFile (wxString fileName) { // minimum requirements for type Cylindrical cableFile <<"# MOD_cable_lib_dir \n"; - cableFile <<"../"<< MODname <<"/CABLE/"<<"\n"; + cableFile <<".." << separator << MODname << separator << "CABLE" << separator <<"\n"; cableFile <<"Cylindrical\n"; cableFile <<"1 #number of conductors \n"; cableFile <<"3 #number of parameters \n"; diff --git a/GUI/SW1/SRC/DCONN.cpp b/GUI/SW1/SRC/DCONN.cpp index b09502f..5c06dcb 100644 --- a/GUI/SW1/SRC/DCONN.cpp +++ b/GUI/SW1/SRC/DCONN.cpp @@ -243,10 +243,14 @@ void DCONN::OnButton2Click(wxCommandEvent& event) wxString fileName = TextCtrl1->GetValue(); wxString command_line; + wxString separator(wxFileName::GetPathSeparator()); + std::stringstream stream; - stream << "cable_model_builder" + + stream <<"." + separator + << "cable_model_builder" << " " - << "..\\" + MODname + "\\CABLE\\" + << ".." + separator + MODname + separator + "CABLE" + separator << fileName ; command_line << stream.str().c_str(); @@ -327,7 +331,9 @@ void DCONN::WriteCableFile(wxString fileName) { ofstream cableFile; - wxString fullFileName = pathToMOD + "/CABLE/" + fileName + ".cable_spec"; + wxString separator(wxFileName::GetPathSeparator()); + + wxString fullFileName = pathToMOD + separator + "CABLE" + separator + fileName + ".cable_spec"; cableFile.open (fullFileName); @@ -335,7 +341,7 @@ void DCONN::WriteCableFile(wxString fileName) { // minimum requirements for type Cylindrical cableFile <<"# MOD_cable_lib_dir \n"; - cableFile <<"../"<< MODname <<"/CABLE/"<<"\n"; + cableFile <<".." << separator << MODname << separator << "CABLE" << separator <<"\n"; cableFile <<"Dconnector\n"; cableFile <<"10 #number of conductors \n"; cableFile <<"4 #number of parameters \n"; diff --git a/GUI/SW1/SRC/FLEXCABLE.cpp b/GUI/SW1/SRC/FLEXCABLE.cpp index 76ed81f..595d263 100644 --- a/GUI/SW1/SRC/FLEXCABLE.cpp +++ b/GUI/SW1/SRC/FLEXCABLE.cpp @@ -314,11 +314,14 @@ void FLEXCABLE::OnButton2Click(wxCommandEvent& event) wxString fileName = TextCtrl1->GetValue(); wxString command_line; + wxString separator(wxFileName::GetPathSeparator()); + std::stringstream stream; - stream << "cable_model_builder" + stream <<"." + separator + << "cable_model_builder" << " " - << "..\\" + MODname + "\\CABLE\\" + << ".." + separator + MODname + separator + "CABLE" + separator << fileName ; command_line << stream.str().c_str(); @@ -417,7 +420,9 @@ void FLEXCABLE::WriteCableFile (wxString fileName) { ofstream cableFile; - wxString fullFileName = pathToMOD + "/CABLE/" + fileName + ".cable_spec"; + wxString separator(wxFileName::GetPathSeparator()); + + wxString fullFileName = pathToMOD + separator + "CABLE" + separator + fileName + ".cable_spec"; cableFile.open (fullFileName); @@ -440,7 +445,7 @@ void FLEXCABLE::WriteCableFile (wxString fileName) if (cableFile.is_open()) { cableFile <<"# MOD_cable_lib_dir \n"; - cableFile <<"../"<< MODname <<"/CABLE/"<<"\n"; + cableFile <<".." << separator << MODname << separator << "CABLE" << separator <<"\n"; cableFile <<"flex_cable\n"; cableFile << n_conductors <<" #number of conductors \n"; cableFile << n_parameters <<" #number of parameters \n"; diff --git a/GUI/SW1/SRC/OVERSHIELD.cpp b/GUI/SW1/SRC/OVERSHIELD.cpp index 7db8450..91ad3c4 100644 --- a/GUI/SW1/SRC/OVERSHIELD.cpp +++ b/GUI/SW1/SRC/OVERSHIELD.cpp @@ -253,10 +253,14 @@ void OVERSHIELD::OnButton2Click(wxCommandEvent& event) wxString fileName = TextCtrl1->GetValue(); wxString command_line; + wxString separator(wxFileName::GetPathSeparator()); + std::stringstream stream; - stream << "cable_model_builder" + + stream <<"." + separator + << "cable_model_builder" << " " - << "..\\" + MODname + "\\CABLE\\" + << ".." + separator + MODname + separator + "CABLE" + separator << fileName ; command_line << stream.str().c_str(); @@ -332,7 +336,9 @@ void OVERSHIELD::WriteCableFile (wxString fileName) { ofstream cableFile; - wxString fullFileName = pathToMOD + "/CABLE/" + fileName + ".cable_spec"; + wxString separator(wxFileName::GetPathSeparator()); + + wxString fullFileName = pathToMOD + separator + "CABLE" + separator + fileName + ".cable_spec"; cableFile.open (fullFileName); @@ -340,7 +346,7 @@ void OVERSHIELD::WriteCableFile (wxString fileName) { // minimum requirements for type Cylindrical cableFile <<"# MOD_cable_lib_dir \n"; - cableFile <<"../"<< MODname <<"/CABLE/"<<"\n"; + cableFile <<".." << separator << MODname << separator << "CABLE" << separator <<"\n"; cableFile <<"Overshield\n"; cableFile <<"1 /t#number of conductors \n"; cableFile <<"3 /t#number of parameters \n"; diff --git a/GUI/SW1/SRC/SPACEWIRE.cpp b/GUI/SW1/SRC/SPACEWIRE.cpp index ee1b8ea..cf6a412 100644 --- a/GUI/SW1/SRC/SPACEWIRE.cpp +++ b/GUI/SW1/SRC/SPACEWIRE.cpp @@ -510,14 +510,16 @@ void SPACEWIRE::OnButton2Click(wxCommandEvent& event) wxString fileName = TextCtrl1->GetValue(); wxString command_line; + wxString separator(wxFileName::GetPathSeparator()); + std::stringstream stream; - stream << "cable_model_builder" + + stream <<"." + separator + << "cable_model_builder" << " " - << "..\\" + MODname + "\\CABLE\\" + << ".." + separator + MODname + separator + "CABLE" + separator << fileName ; - command_line << stream.str().c_str(); - wxExecute (command_line); // Display Run Status @@ -859,7 +861,9 @@ void SPACEWIRE::WriteCableFile (wxString fileName) ofstream cableFile; - wxString fullFileName = pathToMOD + "/CABLE/" + fileName + ".cable_spec"; + wxString separator(wxFileName::GetPathSeparator()); + + wxString fullFileName = pathToMOD + separator + "CABLE" + separator + fileName + ".cable_spec"; cableFile.open (fullFileName); @@ -868,7 +872,7 @@ void SPACEWIRE::WriteCableFile (wxString fileName) // minimum requirements for type Coax cableFile <<"# MOD_cable_lib_dir \n"; - cableFile <<"../"<< MODname <<"/CABLE/"<<"\n"; + cableFile <<".." << separator << MODname << separator << "CABLE" << separator <<"\n"; cableFile <<"Spacewire\n"; cableFile <<"13 \t#number of conductors \n"; cableFile <<"13 \t#number of parameters \n"; diff --git a/GUI/SW1/SRC/SW1_GUIMain.cpp b/GUI/SW1/SRC/SW1_GUIMain.cpp index 68e5e20..a65b2ec 100644 --- a/GUI/SW1/SRC/SW1_GUIMain.cpp +++ b/GUI/SW1/SRC/SW1_GUIMain.cpp @@ -273,7 +273,9 @@ void SW1_GUIFrame::OnSelectMOD(wxCommandEvent& event) } dirDialog->Destroy(); - wxStringTokenizer tkz(PathToMOD, wxT("\\")); + wxString separator(wxFileName::GetPathSeparator()); + + wxStringTokenizer tkz(PathToMOD, separator); while (tkz.HasMoreTokens()) { diff --git a/GUI/SW1/SRC/TP.cpp b/GUI/SW1/SRC/TP.cpp index f957f94..0dfac4c 100644 --- a/GUI/SW1/SRC/TP.cpp +++ b/GUI/SW1/SRC/TP.cpp @@ -467,11 +467,14 @@ void TP::OnButton2Click(wxCommandEvent& event) wxString fileName = TextCtrl1->GetValue(); wxString command_line; + wxString separator(wxFileName::GetPathSeparator()); + std::stringstream stream; - stream << "cable_model_builder" + stream <<"." + separator + << "cable_model_builder" << " " - << "..\\" + MODname + "\\CABLE\\" + << ".." + separator + MODname + separator + "CABLE" + separator << fileName ; command_line << stream.str().c_str(); @@ -701,7 +704,9 @@ void TP::WriteCableFile (wxString fileName) { ofstream cableFile; - wxString fullFileName = pathToMOD + "/CABLE/" + fileName + ".cable_spec"; + wxString separator(wxFileName::GetPathSeparator()); + + wxString fullFileName = pathToMOD + separator + "CABLE" + separator + fileName + ".cable_spec"; cableFile.open (fullFileName); @@ -710,7 +715,7 @@ void TP::WriteCableFile (wxString fileName) // minimum requirements for type Coax cableFile <<"# MOD_cable_lib_dir \n"; - cableFile <<"../"<< MODname <<"/CABLE/"<<"\n"; + cableFile <<".." << separator << MODname << separator << "CABLE" << separator <<"\n"; cableFile <<"Shielded_twisted_pair\n"; cableFile <<"3 \t#number of conductors \n"; cableFile <<"8 \t#number of parameters \n"; diff --git a/GUI/SW1/SRC/TWINAX.cpp b/GUI/SW1/SRC/TWINAX.cpp index 973ea2b..949980c 100644 --- a/GUI/SW1/SRC/TWINAX.cpp +++ b/GUI/SW1/SRC/TWINAX.cpp @@ -441,13 +441,17 @@ void TWINAX::OnButton3Click(wxCommandEvent& event) wxString fileName = TextCtrl1->GetValue(); wxString command_line; + wxString separator(wxFileName::GetPathSeparator()); + std::stringstream stream; - stream << "cable_model_builder" + stream <<"." + separator + << "cable_model_builder" << " " - << "..\\" + MODname + "\\CABLE\\" + << ".." + separator + MODname + separator + "CABLE" + separator << fileName ; + command_line << stream.str().c_str(); wxExecute (command_line); @@ -698,7 +702,9 @@ void TWINAX::WriteCableFile (wxString fileName) { ofstream cableFile; - wxString fullFileName = pathToMOD + "/CABLE/" + fileName + ".cable_spec"; + wxString separator(wxFileName::GetPathSeparator()); + + wxString fullFileName = pathToMOD + separator + "CABLE" + separator + fileName + ".cable_spec"; cableFile.open (fullFileName); @@ -707,7 +713,7 @@ void TWINAX::WriteCableFile (wxString fileName) // minimum requirements for type Twinax cableFile <<"# MOD_cable_lib_dir \n"; - cableFile <<"../"<< MODname <<"/CABLE/"<<"\n"; + cableFile <<".." << separator << MODname << separator << "CABLE" << separator <<"\n"; cableFile <<"Twinax\n"; cableFile <<"3 \t#number of conductors \n"; cableFile <<"8 \t#number of parameters \n"; diff --git a/GUI/SW1/SRC/UTP.cpp b/GUI/SW1/SRC/UTP.cpp index 82a7aa8..6b7e2ac 100644 --- a/GUI/SW1/SRC/UTP.cpp +++ b/GUI/SW1/SRC/UTP.cpp @@ -317,10 +317,14 @@ void UTP::OnButton2Click(wxCommandEvent& event) wxString fileName = TextCtrl1->GetValue(); wxString command_line; + wxString separator(wxFileName::GetPathSeparator()); + std::stringstream stream; - stream << "cable_model_builder" + + stream <<"." + separator + << "cable_model_builder" << " " - << "..\\" + MODname + "\\CABLE\\" + << ".." + separator + MODname + separator + "CABLE" + separator << fileName ; command_line << stream.str().c_str(); @@ -430,7 +434,9 @@ void UTP::WriteCableFile (wxString fileName) ofstream cableFile; - wxString fullFileName = pathToMOD + "/CABLE/" + fileName + ".cable_spec"; + wxString separator(wxFileName::GetPathSeparator()); + + wxString fullFileName = pathToMOD + separator + "CABLE" + separator + fileName + ".cable_spec"; cableFile.open (fullFileName); @@ -438,7 +444,7 @@ void UTP::WriteCableFile (wxString fileName) { // minimum requirements for type UTP cableFile <<"# MOD_cable_lib_dir \n"; - cableFile <<"../"<< MODname <<"/CABLE/"<<"\n"; + cableFile <<".." << separator << MODname << separator << "CABLE" << separator <<"\n"; cableFile <<"Twisted_pair\n"; cableFile <<"2 \t#number of conductors \n"; cableFile <<"4 \t#number of parameters \n"; -- libgit2 0.21.2