Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/trunk@15636 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
db128e1983
commit
6da0b223ba
238
setup/Setup.cpp
238
setup/Setup.cpp
@ -92,6 +92,9 @@ private:
|
|||||||
protected:
|
protected:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
void OnTimer(wxTimerEvent& e);
|
void OnTimer(wxTimerEvent& e);
|
||||||
|
void ClientUpdate();
|
||||||
|
void NormalSetup();
|
||||||
|
|
||||||
bool CreateIcon(unsigned int csidl, const wxFileName& strExeFile, const wxString& strLinkName) const;
|
bool CreateIcon(unsigned int csidl, const wxFileName& strExeFile, const wxString& strLinkName) const;
|
||||||
bool CreateAutostartMode(const int iSrvAutostartMode, const wxString& strPath);
|
bool CreateAutostartMode(const int iSrvAutostartMode, const wxString& strPath);
|
||||||
void AssociateExtension(const wxFileName& strExeFile, const wxString strExt);
|
void AssociateExtension(const wxFileName& strExeFile, const wxString strExt);
|
||||||
@ -101,13 +104,12 @@ protected:
|
|||||||
bool WriteRootRegistryKey(const wxString strKey, const wxString& strValue) const;
|
bool WriteRootRegistryKey(const wxString strKey, const wxString& strValue) const;
|
||||||
bool WriteLocalMachineRegistryKey(const wxString strKey, const wxString& strValue) const;
|
bool WriteLocalMachineRegistryKey(const wxString strKey, const wxString& strValue) const;
|
||||||
|
|
||||||
void CheckAndMakeDir(const wxString& strDir, const wxString& strMsg) const;
|
|
||||||
bool UnzipFile(const char* strZipFile, const char* strDestdir) const;
|
|
||||||
size_t GetZipList(const char* strZipFile, wxArrayString& aFiles) const;
|
|
||||||
const wxString GetSourceDir(const wxString strDirName) const;
|
const wxString GetSourceDir(const wxString strDirName) const;
|
||||||
void UnzipSystem(const wxString& strPrgLocPath) const;
|
void UnzipSystem(const wxString& strPrgLocPath) const;
|
||||||
bool CopyFilesAndDirs(const wxString& FilesListI, wxString strFileCurr, const bool bIni) const;
|
bool CopyFilesAndDirs(const wxString& FilesListI, wxString strFileCurr, const bool bIni) const;
|
||||||
|
|
||||||
|
int UpdateModule(const wxString& strLocalPath, const wxString& strRemotePath, const wxString strModule) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual bool OnInit();
|
virtual bool OnInit();
|
||||||
};
|
};
|
||||||
@ -304,95 +306,8 @@ bool CampoSetup::CreateIcon(unsigned int csidl, const wxFileName& strExeFile, co
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CampoSetup::CheckAndMakeDir(const wxString& strDir, const wxString& strMsg) const
|
|
||||||
{
|
|
||||||
if (!wxDir::Exists(strDir))
|
|
||||||
{
|
|
||||||
const wxFileName fname(strDir + "\\*.*");
|
|
||||||
const wxArrayString& asDirs = fname.GetDirs();
|
|
||||||
wxString strCartella = fname.GetVolume();
|
|
||||||
strCartella += fname.GetVolumeSeparator();
|
|
||||||
for (size_t i = 0; i < asDirs.GetCount(); i++)
|
|
||||||
{
|
|
||||||
strCartella += "\\";
|
|
||||||
strCartella += asDirs[i];
|
|
||||||
if (!wxDir::Exists(strCartella) && !wxMkdir(strCartella))
|
|
||||||
{
|
|
||||||
wxString strError = "Impossibile creare la cartella ";
|
|
||||||
strError += strMsg;
|
|
||||||
strError += " ";
|
|
||||||
strError += strCartella;
|
|
||||||
strError += "\nAssicurarsi di avere il permesso di scrittura sul disco e che vi sia spazio a sufficienza";
|
|
||||||
ErrorBox(strMsg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!strMsg.IsEmpty()) //se il messaggio e' vuoto NON deve fare alcun controllo (installazione sistema)
|
|
||||||
{
|
|
||||||
wxDir dirDir(strDir);
|
|
||||||
if(dirDir.HasFiles()) //se la dir di destinazione dovesse esistere gia' (installazione abortita) almeno sia vuota
|
|
||||||
{
|
|
||||||
ErrorBox("La cartella di destinazione non e' vuota!\nInstallazione interrotta!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t CampoSetup::GetZipList(const char* strZipFile, wxArrayString& aFiles) const
|
|
||||||
{
|
|
||||||
wxFFileInputStream fin(strZipFile);
|
|
||||||
wxZipInputStream zip(fin);
|
|
||||||
for (wxZipEntry* z = zip.GetNextEntry(); z; z = zip.GetNextEntry())
|
|
||||||
{
|
|
||||||
const wxString str = z->GetInternalName();
|
|
||||||
aFiles.Add(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
return aFiles.GetCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CampoSetup::UnzipFile(const char* strZipFile, const char* strDestDir) const
|
|
||||||
{
|
|
||||||
wxArrayString aFiles;
|
|
||||||
const size_t files = GetZipList(strZipFile, aFiles);
|
|
||||||
|
|
||||||
wxProgressDialog pi("Unzip", "", (int)files, NULL, wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT);
|
|
||||||
|
|
||||||
for (unsigned int f = 0; f < files; f++)
|
|
||||||
{
|
|
||||||
const wxString& strFileName = aFiles[f];
|
|
||||||
if (!pi.Update(f, strFileName))
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (wxEndsWithPathSeparator(strFileName) || strFileName.Find('.') < 0) // Is dir name
|
|
||||||
{
|
|
||||||
wxString strOutDir = strDestDir;
|
|
||||||
if (!wxEndsWithPathSeparator(strOutDir))
|
|
||||||
strOutDir += wxFILE_SEP_PATH;
|
|
||||||
strOutDir += strFileName;
|
|
||||||
if (!::wxDirExists(strOutDir))
|
|
||||||
::wxMkdir(strOutDir);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wxZipInputStream fin(strZipFile, strFileName);
|
|
||||||
|
|
||||||
wxString strOutFile = strDestDir;
|
|
||||||
if (!wxEndsWithPathSeparator(strOutFile) && !wxIsPathSeparator(strFileName[0]))
|
|
||||||
strOutFile += wxFILE_SEP_PATH;
|
|
||||||
strOutFile += strFileName;
|
|
||||||
|
|
||||||
wxString strPath;
|
|
||||||
::wxSplitPath(strOutFile, &strPath, NULL, NULL);
|
|
||||||
CheckAndMakeDir(strPath, wxEmptyString);
|
|
||||||
|
|
||||||
wxFileOutputStream fout(strOutFile);
|
|
||||||
fout.Write(fin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return files > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int PatchCompare(const wxString& first, const wxString& second)
|
static int PatchCompare(const wxString& first, const wxString& second)
|
||||||
{
|
{
|
||||||
@ -504,17 +419,151 @@ bool CampoSetup::CopyFilesAndDirs(const wxString& FilesListI, wxString strFileCu
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
//metodo principale dell'applicazione che gestisce l'ordine degli eventi nella installazione vera e propria
|
|
||||||
|
int CampoSetup::UpdateModule(const wxString& strLocalPath, const wxString& strRemotePath, const wxString strModule) const
|
||||||
|
{
|
||||||
|
int nLocVer, nLocPatch, nRemVer, nRemPatch;
|
||||||
|
{
|
||||||
|
CampoIniFile iniLocalInstall(strLocalPath + "/install.ini", strModule);
|
||||||
|
nLocVer = iniLocalInstall.GetInt("Versione");
|
||||||
|
nLocPatch = iniLocalInstall.GetInt("Patch");
|
||||||
|
|
||||||
|
CampoIniFile iniRemoteInstall(strRemotePath + "/install.ini", strModule);
|
||||||
|
nRemVer = iniRemoteInstall.GetInt("Versione");
|
||||||
|
nRemPatch = iniRemoteInstall.GetInt("Patch");
|
||||||
|
}
|
||||||
|
int cmp = nLocVer - nRemVer;
|
||||||
|
if (cmp == 0)
|
||||||
|
cmp = nLocPatch - nRemPatch;
|
||||||
|
|
||||||
|
//il client e' piu' indietro e quindi va aggiornato!
|
||||||
|
if (cmp < 0)
|
||||||
|
{
|
||||||
|
bool bOk = true;
|
||||||
|
|
||||||
|
wxProgressDialog pi("Aggiornamento elenco files dal server...", "", 100, NULL, wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT);
|
||||||
|
|
||||||
|
wxArrayString asGroups;
|
||||||
|
{
|
||||||
|
wxString strGroup;
|
||||||
|
long nIndex;
|
||||||
|
CampoIniFile iniRemoteInstall(strRemotePath + "/install.ini", "");
|
||||||
|
for (bool ok = iniRemoteInstall.GetFirstGroup(strGroup, nIndex); ok; ok = iniRemoteInstall.GetNextGroup(strGroup, nIndex))
|
||||||
|
{
|
||||||
|
if(strGroup.Len() > 2 && strGroup.StartsWith(strModule))
|
||||||
|
asGroups.Add(strGroup);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//controlla tutti i sottomoduli del modulo [sy1],[sy2]...
|
||||||
|
for (size_t i = 0; i < asGroups.GetCount() && bOk; i++)
|
||||||
|
{
|
||||||
|
const wxString& strParagraph = asGroups[i];
|
||||||
|
CampoIniFile iniRemoteInstallModule(strRemotePath + "/install.ini", strParagraph);
|
||||||
|
//ogni file dell'elenco del sottomodulo corrente va copiato
|
||||||
|
for (int j = 0;; j++)
|
||||||
|
{
|
||||||
|
pi.Pulse(); //magica barra modello supercar!
|
||||||
|
|
||||||
|
const wxString strCurrFile = iniRemoteInstallModule.Get(wxString::Format("File(%d)", j));
|
||||||
|
if (strCurrFile.IsEmpty())
|
||||||
|
break;
|
||||||
|
|
||||||
|
const wxString strSrcPath = strRemotePath + "/" + strCurrFile;
|
||||||
|
const wxString strDstPath = strLocalPath + "/" + strCurrFile;
|
||||||
|
|
||||||
|
//copia il file remoto di origine sul file locale di destinazione (overwrite=true di default)
|
||||||
|
if (!wxCopyFile(strSrcPath, strDstPath))
|
||||||
|
{
|
||||||
|
wxString strError = "Impossibile copiare il file ";
|
||||||
|
strError += strSrcPath;
|
||||||
|
strError += " in ";
|
||||||
|
strError += strDstPath;
|
||||||
|
strError += "\nAssicurarsi che il client locale di ";
|
||||||
|
strError += APPNAME;
|
||||||
|
strError += " non sia in funzione.\n";
|
||||||
|
strError += "Assicurarsi che il server di ";
|
||||||
|
strError += APPNAME;
|
||||||
|
strError += " sia in funzione e raggiungibile in rete.\n";
|
||||||
|
strError += "Aggiornamento interrotto!";
|
||||||
|
ErrorBox(strError);
|
||||||
|
bOk = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//se ci sono zip deve scompattarli (per ora esiste solo res.zip)
|
||||||
|
if (strCurrFile.EndsWith("res.zip"))
|
||||||
|
{
|
||||||
|
UnzipFile(strDstPath, strLocalPath + "/res");
|
||||||
|
}
|
||||||
|
} //for(int j...
|
||||||
|
|
||||||
|
//una volta termiata la copia dei files del sottmodulo[i] scatta l'aggiornamento dell'install.ini locale...
|
||||||
|
//...al livello versione/patch appena copiate sempre del sottomodulo[i]
|
||||||
|
CampoIniFile iniLocalInstall(strLocalPath + "/install.ini", strParagraph);
|
||||||
|
iniLocalInstall.Set("Versione", nRemVer);
|
||||||
|
iniLocalInstall.Set("Patch", nRemPatch);
|
||||||
|
|
||||||
|
} //for(int i...
|
||||||
|
|
||||||
|
//una volta termiata la copia dei files dell'intero modulo scatta l'aggiornamento dell'install.ini locale al..
|
||||||
|
//..livello versione/patch appena copiate
|
||||||
|
CampoIniFile iniLocalInstall(strLocalPath + "/install.ini", strModule);
|
||||||
|
iniLocalInstall.Set("Versione", nRemVer);
|
||||||
|
iniLocalInstall.Set("Patch", nRemPatch);
|
||||||
|
|
||||||
|
} //if(cmp<0...
|
||||||
|
|
||||||
|
return cmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//metodo principale che sceglie la modalita' di lancio del programma
|
||||||
void CampoSetup::OnTimer(wxTimerEvent& WXUNUSED(e))
|
void CampoSetup::OnTimer(wxTimerEvent& WXUNUSED(e))
|
||||||
{
|
{
|
||||||
m_pWizard = new CampoWizard(m_pMainFrame);
|
|
||||||
|
|
||||||
wxFileName strPath = argv[0];
|
wxFileName strPath = argv[0];
|
||||||
strPath.SetCwd();
|
strPath.SetCwd();
|
||||||
//path del programma setup.exe in esecuzione; serve in seguito in quanto alcuni metodi (tipo la GetAllFiles)..
|
//path del programma setup.exe in esecuzione; serve in seguito in quanto alcuni metodi (tipo la GetAllFiles)..
|
||||||
//..fanno perdere questo path
|
//..fanno perdere questo path
|
||||||
m_strSetupPath = strPath.GetPath();
|
m_strSetupPath = strPath.GetPath();
|
||||||
|
|
||||||
|
wxString strCommand = argv[1];
|
||||||
|
if (strCommand.IsEmpty())
|
||||||
|
NormalSetup();
|
||||||
|
else
|
||||||
|
ClientUpdate();
|
||||||
|
|
||||||
|
//finestrina x chiudere a mano il programma (sconsigliata causa lancio ba1.exe)
|
||||||
|
// ::wxMessageBox(wxT("Installazione terminata"), APPNAME, wxOK | wxICON_INFORMATION);
|
||||||
|
m_pMainFrame->Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//metodo per l'aggiornamento dei client di rete
|
||||||
|
void CampoSetup::ClientUpdate()
|
||||||
|
{
|
||||||
|
wxFileName fn(m_strSetupPath, "install.ini");
|
||||||
|
fn.AppendDir("..");
|
||||||
|
fn.MakeAbsolute();
|
||||||
|
const wxString strLocalPath = fn.GetPath();
|
||||||
|
wxString strRemotePath;
|
||||||
|
{
|
||||||
|
//Install.ini locale da cui leggere il path di dove sta il mio server dei programmi
|
||||||
|
CampoIniFile iniLocalInstall(fn.GetFullPath(), "Main");
|
||||||
|
strRemotePath = iniLocalInstall.Get("DiskPath");
|
||||||
|
}
|
||||||
|
UpdateModule(strLocalPath, strRemotePath, "sy");
|
||||||
|
|
||||||
|
//lanciare ba1.exe -6 in uscita
|
||||||
|
wxSetWorkingDirectory(strLocalPath);
|
||||||
|
wxExecute("ba1 -6 /uADMIN");
|
||||||
|
}
|
||||||
|
|
||||||
|
//metodo per tutte le installazioni e gli aggiornamenti in locale
|
||||||
|
void CampoSetup::NormalSetup()
|
||||||
|
{
|
||||||
|
m_pWizard = new CampoWizard(m_pMainFrame);
|
||||||
|
|
||||||
if (m_pWizard->Run())
|
if (m_pWizard->Run())
|
||||||
{
|
{
|
||||||
//e' una DEMO o una versione normale?
|
//e' una DEMO o una versione normale?
|
||||||
@ -806,9 +855,6 @@ void CampoSetup::OnTimer(wxTimerEvent& WXUNUSED(e))
|
|||||||
} //if (m_pWizard->Run())...
|
} //if (m_pWizard->Run())...
|
||||||
m_pWizard->Destroy();
|
m_pWizard->Destroy();
|
||||||
|
|
||||||
//finestrina x chiudere a mano il programma (sconsigliata causa lancio ba1.exe)
|
|
||||||
// ::wxMessageBox(wxT("Installazione terminata"), APPNAME, wxOK | wxICON_INFORMATION);
|
|
||||||
m_pMainFrame->Destroy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CampoSetup::OnInit()
|
bool CampoSetup::OnInit()
|
||||||
|
112
setup/utils.cpp
112
setup/utils.cpp
@ -5,6 +5,7 @@
|
|||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
wxString GetDefaultDestination()
|
wxString GetDefaultDestination()
|
||||||
{
|
{
|
||||||
wxString strDest;
|
wxString strDest;
|
||||||
@ -33,6 +34,8 @@ wxString GetDefaultDestination()
|
|||||||
return strDest;
|
return strDest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//finestre per messaggi vari
|
||||||
|
//---------------------------------------------------------------------------------
|
||||||
bool ErrorBox(const wxString str)
|
bool ErrorBox(const wxString str)
|
||||||
{
|
{
|
||||||
wxMessageBox(str, APPNAME, wxOK | wxICON_ERROR);
|
wxMessageBox(str, APPNAME, wxOK | wxICON_ERROR);
|
||||||
@ -45,6 +48,9 @@ bool WarningBox(const wxString str)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//classe per gestire i .Ini di campo
|
||||||
|
//-----------------------------------------------------------------------------------
|
||||||
CampoIniFile::CampoIniFile(const wxString strIniPath, const wxString strParagraph)
|
CampoIniFile::CampoIniFile(const wxString strIniPath, const wxString strParagraph)
|
||||||
: wxFileConfig (wxEmptyString, wxEmptyString, strIniPath, wxEmptyString,
|
: wxFileConfig (wxEmptyString, wxEmptyString, strIniPath, wxEmptyString,
|
||||||
wxCONFIG_USE_LOCAL_FILE|wxCONFIG_USE_NO_ESCAPE_CHARACTERS)
|
wxCONFIG_USE_LOCAL_FILE|wxCONFIG_USE_NO_ESCAPE_CHARACTERS)
|
||||||
@ -64,6 +70,14 @@ bool CampoIniFile::GetBool(const wxString strVariable) const
|
|||||||
return strBool == "X" || strBool == "Y";
|
return strBool == "X" || strBool == "Y";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CampoIniFile::GetInt(const wxString strVariable) const
|
||||||
|
{
|
||||||
|
wxString str = Get(strVariable);
|
||||||
|
long val = 0;
|
||||||
|
str.ToLong(&val);
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
bool CampoIniFile::Set(const wxString strVariable, const wxString strValue)//, const wxString strParagraph) const
|
bool CampoIniFile::Set(const wxString strVariable, const wxString strValue)//, const wxString strParagraph) const
|
||||||
{
|
{
|
||||||
return Write(strVariable, strValue);
|
return Write(strVariable, strValue);
|
||||||
@ -73,3 +87,101 @@ bool CampoIniFile::Set(const wxString strVariable, const int uValue)//, const wx
|
|||||||
{
|
{
|
||||||
return Write(strVariable, uValue);
|
return Write(strVariable, uValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//gestione filesystem
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
void CheckAndMakeDir(const wxString& strDir, const wxString& strMsg)
|
||||||
|
{
|
||||||
|
if (!wxDir::Exists(strDir))
|
||||||
|
{
|
||||||
|
const wxFileName fname(strDir + "\\*.*");
|
||||||
|
const wxArrayString& asDirs = fname.GetDirs();
|
||||||
|
wxString strCartella = fname.GetVolume();
|
||||||
|
strCartella += fname.GetVolumeSeparator();
|
||||||
|
for (size_t i = 0; i < asDirs.GetCount(); i++)
|
||||||
|
{
|
||||||
|
strCartella += "\\";
|
||||||
|
strCartella += asDirs[i];
|
||||||
|
if (!wxDir::Exists(strCartella) && !wxMkdir(strCartella))
|
||||||
|
{
|
||||||
|
wxString strError = "Impossibile creare la cartella ";
|
||||||
|
strError += strMsg;
|
||||||
|
strError += " ";
|
||||||
|
strError += strCartella;
|
||||||
|
strError += "\nAssicurarsi di avere il permesso di scrittura sul disco e che vi sia spazio a sufficienza";
|
||||||
|
ErrorBox(strMsg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!strMsg.IsEmpty()) //se il messaggio e' vuoto NON deve fare alcun controllo (installazione sistema)
|
||||||
|
{
|
||||||
|
wxDir dirDir(strDir);
|
||||||
|
if(dirDir.HasFiles()) //se la dir di destinazione dovesse esistere gia' (installazione abortita) almeno sia vuota
|
||||||
|
{
|
||||||
|
ErrorBox("La cartella di destinazione non e' vuota!\nInstallazione interrotta!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//metodi per unzippare i files
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
static size_t GetZipList(const char* strZipFile, wxArrayString& aFiles)
|
||||||
|
{
|
||||||
|
wxFFileInputStream fin(strZipFile);
|
||||||
|
wxZipInputStream zip(fin);
|
||||||
|
for (wxZipEntry* z = zip.GetNextEntry(); z; z = zip.GetNextEntry())
|
||||||
|
{
|
||||||
|
const wxString str = z->GetInternalName();
|
||||||
|
aFiles.Add(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
return aFiles.GetCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
for (unsigned int f = 0; f < files; f++)
|
||||||
|
{
|
||||||
|
const wxString& strFileName = aFiles[f];
|
||||||
|
if (!pi.Update(f, strFileName))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (wxEndsWithPathSeparator(strFileName) || strFileName.Find('.') < 0) // Is dir name
|
||||||
|
{
|
||||||
|
wxString strOutDir = strDestDir;
|
||||||
|
if (!wxEndsWithPathSeparator(strOutDir))
|
||||||
|
strOutDir += wxFILE_SEP_PATH;
|
||||||
|
strOutDir += strFileName;
|
||||||
|
if (!::wxDirExists(strOutDir))
|
||||||
|
::wxMkdir(strOutDir);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxZipInputStream fin(strZipFile, strFileName);
|
||||||
|
|
||||||
|
wxString strOutFile = strDestDir;
|
||||||
|
if (!wxEndsWithPathSeparator(strOutFile) && !wxIsPathSeparator(strFileName[0]))
|
||||||
|
strOutFile += wxFILE_SEP_PATH;
|
||||||
|
strOutFile += strFileName;
|
||||||
|
|
||||||
|
wxString strPath;
|
||||||
|
::wxSplitPath(strOutFile, &strPath, NULL, NULL);
|
||||||
|
CheckAndMakeDir(strPath, wxEmptyString);
|
||||||
|
|
||||||
|
wxFileOutputStream fout(strOutFile);
|
||||||
|
fout.Write(fin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return files > 0;
|
||||||
|
}
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
#ifndef __UTILS_H
|
#ifndef __UTILS_H
|
||||||
#define __UTILS_H
|
#define __UTILS_H
|
||||||
|
|
||||||
bool ErrorBox(const wxString str);
|
|
||||||
bool WarningBox(const wxString str);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//Classe per la gestione dei files di configurazione tipo campo.ini
|
//Classe per la gestione dei files di configurazione tipo campo.ini
|
||||||
class CampoIniFile : public wxFileConfig
|
class CampoIniFile : public wxFileConfig
|
||||||
@ -12,10 +9,18 @@ protected:
|
|||||||
public:
|
public:
|
||||||
wxString Get(const wxString strVariable) const;
|
wxString Get(const wxString strVariable) const;
|
||||||
bool GetBool(const wxString strVariable) const;
|
bool GetBool(const wxString strVariable) const;
|
||||||
|
int GetInt (const wxString strVariable) const;
|
||||||
bool Set(const wxString strVariable, const wxString strValue);//, const wxString strParagraph) const;
|
bool Set(const wxString strVariable, const wxString strValue);//, const wxString strParagraph) const;
|
||||||
bool Set(const wxString strVariable, const int uValue);
|
bool Set(const wxString strVariable, const int uValue);
|
||||||
|
|
||||||
CampoIniFile(const wxString strIniPath, wxString strValue);
|
CampoIniFile(const wxString strIniPath, wxString strValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
bool ErrorBox(const wxString str);
|
||||||
|
bool WarningBox(const wxString str);
|
||||||
|
|
||||||
|
void CheckAndMakeDir(const wxString& strDir, const wxString& strMsg);
|
||||||
|
bool UnzipFile(const char* strZipFile, const char* strDestdir);
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
x
Reference in New Issue
Block a user