CopyFile(const std::string& theSourceFileName,
const std::string& theTargetFileName)
{
- QFileInfo aSourceFileInfo(theSourceFileName.c_str());
- QFileInfo aTargetFileInfo(theTargetFileName.c_str());
+ QString aSourcePath = theSourceFileName.c_str();
+#ifdef WNT
+ aSourcePath.replace( QString("/"), QString("\\") );
+ int prevSlash = 0;
+ for ( int ind = 0; ind < aSourcePath.length(); ind ++ )
+ {
+ if ( aSourcePath.at( ind ) == '\\' )
+ prevSlash = ind;
+ if ( aSourcePath.at( ind ) == ' ' )
+ {
+ int nextSlash = aSourcePath.indexOf( '\\', ind);
+ if ( aSourcePath.at( nextSlash - 1 ) != '"' )
+ {
+ aSourcePath.insert( nextSlash, '"');
+ aSourcePath.insert( prevSlash + 1, '"');
+ ind++;
+ }
+ }
+ }
+#endif
+
+ QFileInfo aSourceFileInfo( aSourcePath );
+ QFileInfo aTargetFileInfo( theTargetFileName.c_str() );
if(aSourceFileInfo.absoluteFilePath() == aTargetFileInfo.absoluteFilePath())
return true;
QString aCommand;
- aCommand.sprintf("%s %s %s",
- COPY_COMMAND,
- aSourceFileInfo.filePath().toLatin1().data(),
- aTargetFileInfo.filePath().toLatin1().data());
+ aCommand.sprintf("%s %s %s", COPY_COMMAND,
+ aSourcePath.toLatin1().data(),
+ theTargetFileName.c_str());
return system(aCommand.toLatin1().data()) == 0;
}