From: apo Date: Thu, 19 Jul 2007 11:16:02 +0000 (+0000) Subject: To improve naming of stored files X-Git-Tag: T_MULTIPR_INDUS_2007-07-23~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f87daaedd5edce42d9927441f749397fdf888b80;p=modules%2Fvisu.git To improve naming of stored files --- diff --git a/src/VISU_I/VISU_MultiResult_i.cc b/src/VISU_I/VISU_MultiResult_i.cc index 3a2ee405..8f211473 100644 --- a/src/VISU_I/VISU_MultiResult_i.cc +++ b/src/VISU_I/VISU_MultiResult_i.cc @@ -683,7 +683,7 @@ VISU::MultiResult_i { std::string aBase, aSuffix; - SplitName(GetFileName(), aBase, aSuffix); + VISU::SplitName(GetFileName(), aBase, aSuffix); INITMSG(MYDEBUG, "aBase = '"<NewBuilder(); _PTR(SObject) aFather = theStudyDocument->FindObjectID(theFatherEntry); @@ -644,6 +656,9 @@ namespace VISU { QFileInfo aSourceFileInfo(theSourceFileName); QFileInfo aTargetFileInfo(theTargetFileName); + if(aSourceFileInfo.absFilePath() == aTargetFileInfo.absFilePath()) + return true; + QString aCommand; aCommand.sprintf("%s %s %s", COPY_COMMAND, diff --git a/src/VISU_I/VISU_ResultUtils.hh b/src/VISU_I/VISU_ResultUtils.hh index f6807a7b..357dfd49 100644 --- a/src/VISU_I/VISU_ResultUtils.hh +++ b/src/VISU_I/VISU_ResultUtils.hh @@ -82,6 +82,12 @@ namespace VISU char theDelimeter = ':'); + //---------------------------------------------------------------------------- + std::string + MakeFileName(const std::string& theName, + const void* thePointer); + + //---------------------------------------------------------------------------- void BuildEntities(Result_i* theResult, diff --git a/src/VISU_I/VISU_Result_i.cc b/src/VISU_I/VISU_Result_i.cc index 08b9fab4..12fad523 100644 --- a/src/VISU_I/VISU_Result_i.cc +++ b/src/VISU_I/VISU_Result_i.cc @@ -508,8 +508,8 @@ VISU::Result_i if(mySourceId == eRestoredFile){ QString aTmpDir(SALOMEDS_Tool::GetTmpDir().c_str()); - QString aSuffix = QString::number(size_t(this)); - QString aPathToCopy(aTmpDir + myFileInfo.fileName() + ":" + aSuffix); + std::string aFileName = VISU::MakeFileName(myFileInfo.fileName().latin1(), this); + QString aPathToCopy(aTmpDir + aFileName.c_str()); if(!VISU::CopyFile(myFileInfo.absFilePath().latin1(), aPathToCopy.latin1())) return NULL; @@ -809,7 +809,7 @@ VISU::Result_i } else if (!theIsMultiFile) { mySourceId = eRestoredFile; } else { - mySourceId = eFile; + mySourceId = eSavedFile; } if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - mySourceId = " << mySourceId); myInput.reset(CreateConvertor(myFileInfo.filePath().latin1())); @@ -1324,8 +1324,8 @@ VISU::Result_i ::GetFileName() const { if(GetSourceId() == eFile) - return QString("%1:%2").arg(myFileName.c_str()).arg(size_t(this)).latin1(); - + return VISU::MakeFileName(myFileName, this); + return myFileName; } @@ -1405,9 +1405,8 @@ VISU::Result_i ::~Result_i() { MESSAGE("Result_i::~Result_i() - this = "<