Patch level :

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :


git-svn-id: svn://10.65.10.50/trunk@15900 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2007-12-17 16:36:30 +00:00
parent a7038abcc0
commit cba9f515fe
3 changed files with 32 additions and 18 deletions

View File

@ -437,16 +437,7 @@ bool CampoSetup::CopyFilesAndDirs(const wxString& FilesListI, wxString strFileCu
if (!strDir.IsEmpty() && !wxDirExists(strDir)) if (!strDir.IsEmpty() && !wxDirExists(strDir))
wxMkdir(strDir); wxMkdir(strDir);
if(!wxCopyFile(FilesListI, strFileCurr)) ok = CopiaFile(FilesListI, strFileCurr);
{
wxString strErr = "Impossibile copiare il file ";
strErr += FilesListI;
strErr += " in ";
strErr += strFileCurr;
strErr += "\nInstallazione interrotta!";
ErrorBox(strErr);
ok = false;
}
} }
return ok; return ok;
} }
@ -462,7 +453,7 @@ void CampoSetup::CopyDir(const wxString& strSourceDir, const wxString& strDestDi
for (size_t i = 0; i < uFilesToCopy; i++) for (size_t i = 0; i < uFilesToCopy; i++)
{ {
wxString strFileDest = strDestDir + asFilesList[i].Mid(uFrom); wxString strFileDest = strDestDir + asFilesList[i].Mid(uFrom);
::wxCopyFile(asFilesList[i], strFileDest); CopiaFile(asFilesList[i], strFileDest);
} }
} }
@ -544,12 +535,9 @@ int CampoSetup::ClientUpdateModule(const wxString& strLocalPath, const wxString&
const wxString strDstPath = strLocalPath + "/" + strCurrFile; const wxString strDstPath = strLocalPath + "/" + strCurrFile;
//copia il file remoto di origine sul file locale di destinazione (overwrite=true di default) //copia il file remoto di origine sul file locale di destinazione (overwrite=true di default)
if (!wxCopyFile(strSrcPath, strDstPath)) if (!CopiaFile(strSrcPath, strDstPath))
{ {
wxString strError = "Impossibile copiare il file "; wxString strError;
strError += strSrcPath;
strError += " in ";
strError += strDstPath;
strError += "\nAssicurarsi che il client locale di "; strError += "\nAssicurarsi che il client locale di ";
strError += APPNAME; strError += APPNAME;
strError += " non sia in funzione.\n"; strError += " non sia in funzione.\n";

View File

@ -395,6 +395,31 @@ void CheckAndMakeDir(const wxString& strDir, const wxString& strMsg)
} }
} }
bool CopiaFile(const wxString& strFileSrc, const wxString& strFileDest)
{
bool ok = ::wxCopyFile(strFileSrc, strFileDest);
if(ok)
{
#ifdef WIN32
DWORD dwFileAttribs = ::GetFileAttributes(strFileDest);
if (dwFileAttribs & FILE_ATTRIBUTE_READONLY)
{
dwFileAttribs &= ~FILE_ATTRIBUTE_READONLY;
::SetFileAttributes(strFileDest, dwFileAttribs);
}
#endif
}
else
{
wxString strErr = "Impossibile copiare il file ";
strErr += strFileSrc;
strErr += " in ";
strErr += strFileDest;
strErr += "\nInstallazione interrotta!";
ErrorBox(strErr);
}
return ok;
}
//metodi per unzippare i files //metodi per unzippare i files
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
@ -418,7 +443,7 @@ bool UnzipFile(const char* strZipFile, const char* strDestDir)
wxArrayString aFiles; wxArrayString aFiles;
const size_t files = GetZipList(strZipFile, aFiles); const size_t files = GetZipList(strZipFile, aFiles);
wxProgressDialog pi("Unzip", "", (int)files, NULL, wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT); CampoProgressDialog pi(strZipFile, (int)files);
for (unsigned int f = 0; f < files; f++) for (unsigned int f = 0; f < files; f++)
{ {

View File

@ -59,6 +59,7 @@ bool WarningBox(const wxString str);
//trattamento files //trattamento files
void CheckAndMakeDir(const wxString& strDir, const wxString& strMsg); void CheckAndMakeDir(const wxString& strDir, const wxString& strMsg);
bool UnzipFile(const char* strZipFile, const char* strDestdir); bool UnzipFile(const char* strZipFile, const char* strDestdir);
bool CopiaFile(const wxString& file1, const wxString& file2);
//interfaccia con windows //interfaccia con windows
wxString GetWindowsProgramDirectory(); wxString GetWindowsProgramDirectory();