payal
11th March 2010, 09:53
Hi all,
I am facing one problem while copying an XML file from one place to another place in my filesystem.I am using following code for copying. Test1 and Test2 are the different folders.
but everytime both the boolean variables are returning false.I dont have any idea.
Could anyone plz help me ?
QString FirstPath = QDir::currentPath()+QDir::separator()+"Test1"+ QDir::separator() +"Test1.xml";
FirstPath = QDir::toNativeSeparators(FirstPath);
qDebug()<<FirstPath;
QString SecondFilePath = QDir::currentPath()+QDir::separator()+"Test1" + QDir::separator()+ "Test2" +QDir::separator()+ "Test2.xml";
SecondFilePath = QDir::toNativeSeparators(SecondFilePath);
qDebug()<<SecondFilePath;
QFile file;
if (!file.exists(FirstPath))
{
QFile file(SecondFilePath);
bool ret1= file.copy(FirstPath);
qDebug()<<ret1;
}
QFile prefFile(FirstPath);
bool ret2= prefFile.setPermissions(QFile::WriteUser);
qDebug()<<ret2;
Trying to access these paths,
Test1->Test2->Test2.xml & Test1->Test1.xml
I am facing one problem while copying an XML file from one place to another place in my filesystem.I am using following code for copying. Test1 and Test2 are the different folders.
but everytime both the boolean variables are returning false.I dont have any idea.
Could anyone plz help me ?
QString FirstPath = QDir::currentPath()+QDir::separator()+"Test1"+ QDir::separator() +"Test1.xml";
FirstPath = QDir::toNativeSeparators(FirstPath);
qDebug()<<FirstPath;
QString SecondFilePath = QDir::currentPath()+QDir::separator()+"Test1" + QDir::separator()+ "Test2" +QDir::separator()+ "Test2.xml";
SecondFilePath = QDir::toNativeSeparators(SecondFilePath);
qDebug()<<SecondFilePath;
QFile file;
if (!file.exists(FirstPath))
{
QFile file(SecondFilePath);
bool ret1= file.copy(FirstPath);
qDebug()<<ret1;
}
QFile prefFile(FirstPath);
bool ret2= prefFile.setPermissions(QFile::WriteUser);
qDebug()<<ret2;
Trying to access these paths,
Test1->Test2->Test2.xml & Test1->Test1.xml