From: ana Date: Fri, 3 Dec 2010 15:54:58 +0000 (+0000) Subject: fix for the IPAL22001: jpeg2yuv is not available on winXP stations X-Git-Tag: mergeto_V6_main_21Mar11~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=62e82f16cdd2d2fa64b04fa56f3c4cd93f2d3591;p=modules%2Fvisu.git fix for the IPAL22001: jpeg2yuv is not available on winXP stations --- diff --git a/src/VISU_I/VISU_TimeAnimation.cxx b/src/VISU_I/VISU_TimeAnimation.cxx index 6e45c8bd..c867f9bf 100644 --- a/src/VISU_I/VISU_TimeAnimation.cxx +++ b/src/VISU_I/VISU_TimeAnimation.cxx @@ -1500,24 +1500,31 @@ void VISU_TimeAnimation::run() // add missing files if (anIndexList.count() > 1) { - QString aFFile = aDirPath + QDir::separator() + aBaseName; + QString aFFile = aDirPath + "/" + aBaseName; aFFile += QString("_%1.jpeg"); int aStartIndex = anIndexList[0], anEndIndex; for (int i = 1; i < anIndexList.count(); i++) { anEndIndex = anIndexList[i]; QString aCurFile = aFFile.arg(QString::number(aStartIndex).rightJustified(8, '0')); QStringList aCommands; + QString aSeparator; for (int j = aStartIndex+1; j < anEndIndex; j++) { QString aFile = aFFile.arg(QString::number(j).rightJustified(8, '0')); +#ifndef WIN32 aCommands.append(QString("ln -s %1 %2").arg(aCurFile).arg(aFile)); + aSeparator = QString(" ; \\\n"); +#else + aCommands.append(QString("COPY /Y %1 %2 > NUL").arg(QString(aCurFile).replace("/","\\\\")).arg(QString(aFile).replace("/","\\\\"))); + aSeparator = QString(" & "); +#endif } - system(aCommands.join(" ; \\\n").toLatin1().data()); + system(aCommands.join(aSeparator).toLatin1().data()); aStartIndex = anEndIndex; } } // make AVI file - QString aPattern = aDirPath + QDir::separator() + aBaseName; + QString aPattern = aDirPath + "/" + aBaseName; aPattern += "_\%08d.jpeg"; QString aCmd = myAVIMaker; @@ -1526,18 +1533,29 @@ void VISU_TimeAnimation::run() aCmd += QString(" -f %1").arg(aFPS); // aCmd += QString(" -n %1").arg(aNbFiles); aCmd += QString(" -n %1").arg(myFileIndex+1); - aCmd += QString(" -j %1").arg(aPattern); + aCmd += QString(" -j \"%1\"").arg(aPattern); aCmd += " | yuv2lav"; - aCmd += QString(" -o %1").arg(myDumpPath); + aCmd += QString(" -o \"%1\"").arg(myDumpPath); + #ifdef WIN32 + aCmd += " -f aA"; + #endif system(aCmd.toLatin1().data()); // remove temporary jpeg files +#ifndef WIN32 aCmd = "( "; aCmd += QString("cd %1").arg(aDirPath); aCmd += "; ls"; aCmd += QString(" | egrep '%1_[0-9]*.jpeg'").arg(aBaseName); aCmd += " | xargs rm"; aCmd += " )"; +#else + QString tmpFile = QString("_") + aBaseName + "_tempfile"; + QString diskName = aDirPath.split("/")[0]; + aCmd = diskName + " && (cd " + aDirPath.replace("/","\\\\") + + " && ((dir /b | findstr " + aBaseName + "_[0-9]*.jpeg > " + tmpFile + + ") & (for /f %i in (" + tmpFile + ") do (del \"%i\")) & (del " + tmpFile + "))) > NUL"; +#endif system(aCmd.toLatin1().data()); } @@ -1683,9 +1701,12 @@ bool VISU_TimeAnimation::checkAVIMaker() const aDumpFormats.indexOf("jpeg") < 0) return false; - QString aCmd("which "); - aCmd += myAVIMaker; - aCmd += " >& /dev/null"; + QString aCmd; +#ifndef WIN32 + aCmd = "which " + myAVIMaker + " >& /dev/null"; +#else + aCmd = "setlocal & set P2=.;%PATH% & (for %e in (%PATHEXT%) do @for %i in (" + myAVIMaker + "%e) do @if NOT \"%~$P2:i\"==\"\" exit /b 0) & exit /b 1"; +#endif int iErr = system(aCmd.toLatin1().data()); return (iErr == 0); }