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

@ -118,7 +118,7 @@ protected:
const wxString GetSourceDir(const wxString strDirName) const;
void EmptyOutDir(const wxString& strDir) const;
bool UnzipModule(const wxString& strPrgLocPath, const wxString& strSrc, const wxString& strModule) const;
void CopyDir(const wxString& strSourceDir, const wxString& strDestDir) const;
void CopyDir(const wxString& strSourceDir, const wxString& strDestDir) const;
bool CopyFilesAndDirs(const wxString& FilesListI, wxString strFileCurr, const bool bIni) const;
void UpdateInstallIni(const wxString strSourcePath, const wxString strDestPath, const wxString& strModule) const;
bool HTTPGet(const wxString& strLocalPath, const wxString& strWebPath) const;
@ -437,16 +437,7 @@ bool CampoSetup::CopyFilesAndDirs(const wxString& FilesListI, wxString strFileCu
if (!strDir.IsEmpty() && !wxDirExists(strDir))
wxMkdir(strDir);
if(!wxCopyFile(FilesListI, strFileCurr))
{
wxString strErr = "Impossibile copiare il file ";
strErr += FilesListI;
strErr += " in ";
strErr += strFileCurr;
strErr += "\nInstallazione interrotta!";
ErrorBox(strErr);
ok = false;
}
ok = CopiaFile(FilesListI, strFileCurr);
}
return ok;
}
@ -462,7 +453,7 @@ void CampoSetup::CopyDir(const wxString& strSourceDir, const wxString& strDestDi
for (size_t i = 0; i < uFilesToCopy; i++)
{
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;
//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 ";
strError += strSrcPath;
strError += " in ";
strError += strDstPath;
wxString strError;
strError += "\nAssicurarsi che il client locale di ";
strError += APPNAME;
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
//-------------------------------------------------------------------------------
@ -418,7 +443,7 @@ bool UnzipFile(const char* strZipFile, const char* strDestDir)
wxArrayString 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++)
{

View File

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