I have file which contain the relative path of all the c file like below
RBA\AUTOSAR\SW\BSW\PF\BSMM\BswM\src\BswM.c
RBA\AUTOSAR\SW\BSW\PF\BSMM\BswM\src\BswM_CanSM.c
RBA\AUTOSAR\SW\BSW\PF\BSMM\BswM\src\BswM_ComM.c
RBA\AUTOSAR\SW\BSW\PF\BSMM\BswM\src\BswM_DCM.c
RBA\AUTOSAR\SW\BSW\PF\BSMM\BswM\src\BswM_EthSM.c
RBA\AUTOSAR\SW\BSW\PF\BSMM\BswM\src\BswM_FrSM.c
RBA\AUTOSAR\SW\BSW\PF\BSMM\BswM\src\BswM_Generic.c
RBA\AUTOSAR\SW\BSW\PF\BSMM\BswM\src\BswM_LinSM.c
I am able to open and read the file path but not able to copy
QDir directory
("Documents");
QString path
= directory.
filePath(" ");
ui->le_filename->setText(fileName);
{
return;
}
QFile::Copy(line ,
"D:\Polyspace\Source");
//Nothing is getting copy where line = RBA\AUTOSAR\SW\BSW\PF\BSMM\BswM\src\BswM.c
QDir directory("Documents");
QString path = directory.filePath(" ");
QString fileName = QFileDialog::getOpenFileName(this,tr("Open File"),path,tr("(*.lst)"));
ui->le_filename->setText(fileName);
QFile file(fileName);
if(!file.open(QIODevice::ReadOnly))
{
return;
}
QString line = file.readLine();
QFile::Copy(line ,"D:\Polyspace\Source");//Nothing is getting copy where line = RBA\AUTOSAR\SW\BSW\PF\BSMM\BswM\src\BswM.c
To copy to clipboard, switch view to plain text mode
So my code should create a folder and copy all the c file from the relative path of text file to the folder.
I am trying to use QFile::copy("path1/file", "path2/file");but I am not able to create a proper path.
So my problem are like below
1.how can I convert the relative path to Absolute path
2.another problem is that text file is having the "\" slash where as Qt open file with "/"slash.
3.How to create folder using qt code.
Please let me know I achieve above problem
Bookmarks