mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-27 03:10:54 +00:00
Merge with develop
This commit is contained in:
parent
2379918a3e
commit
364efba09d
8 changed files with 104 additions and 102 deletions
|
@ -1,9 +1,9 @@
|
|||
version=3
|
||||
version=4
|
||||
|
||||
[common]
|
||||
installation_directory=
|
||||
installer_filename_windows=ryzom_installer_qt_r.exe
|
||||
installer_filename_osx=RyzomInstaller.app/Contents/MacOS/RyzomInstaller
|
||||
installer_filename_osx="Ryzom Installer.app/Contents/MacOS/Ryzom Installer"
|
||||
installer_filename_linux=ryzom_installer_qt
|
||||
|
||||
[product]
|
||||
|
|
|
@ -106,22 +106,25 @@ bool CConfigFile::load(const QString &filename)
|
|||
m_productHelpUrl = settings.value("url_help").toString();
|
||||
m_productComments = settings.value("comments").toString();
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
settings.beginGroup("servers");
|
||||
int serversCount = settings.value("size").toInt();
|
||||
m_defaultServerIndex = settings.value("default").toInt();
|
||||
settings.beginGroup("servers");
|
||||
int serversCount = settings.value("size").toInt();
|
||||
m_defaultServerIndex = settings.value("default").toInt();
|
||||
settings.endGroup();
|
||||
|
||||
// only resize if added servers in local ryzom_installer.ini
|
||||
int oldServersCount = m_servers.size();
|
||||
|
||||
if (serversCount > oldServersCount) m_servers.resize(serversCount);
|
||||
|
||||
for (int i = oldServersCount; i < serversCount; ++i)
|
||||
{
|
||||
CServer &server = m_servers[i];
|
||||
|
||||
settings.beginGroup(QString("server_%1").arg(i));
|
||||
server.loadFromSettings(settings);
|
||||
settings.endGroup();
|
||||
|
||||
m_servers.resize(serversCount);
|
||||
|
||||
for (int i = 0; i < serversCount; ++i)
|
||||
{
|
||||
CServer &server = m_servers[i];
|
||||
|
||||
settings.beginGroup(QString("server_%1").arg(i));
|
||||
server.loadFromSettings(settings);
|
||||
settings.endGroup();
|
||||
}
|
||||
}
|
||||
|
||||
// custom choices, always keep them
|
||||
|
@ -492,11 +495,6 @@ QString CConfigFile::getParentDirectory()
|
|||
return current.absolutePath();
|
||||
}
|
||||
|
||||
QString CConfigFile::getApplicationDirectory()
|
||||
{
|
||||
return QApplication::applicationDirPath();
|
||||
}
|
||||
|
||||
QString CConfigFile::getOldInstallationDirectory()
|
||||
{
|
||||
// HKEY_CURRENT_USER/SOFTWARE/Nevrax/RyzomInstall/InstallId=1917716796 (string)
|
||||
|
@ -757,7 +755,19 @@ QString CConfigFile::getInstallerCurrentFilePath() const
|
|||
QString CConfigFile::getInstallerCurrentDirPath() const
|
||||
{
|
||||
// installer is always run from TEMP under Windows
|
||||
return QApplication::applicationDirPath();
|
||||
QString appDir = QApplication::applicationDirPath();
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
QDir dir(appDir);
|
||||
dir.cdUp(); // .. = Contents
|
||||
dir.cdUp(); // .. = .app
|
||||
dir.cdUp(); // .. = <parent>
|
||||
|
||||
// return absolute path
|
||||
appDir = dir.absolutePath();
|
||||
#endif
|
||||
|
||||
return appDir;
|
||||
}
|
||||
|
||||
QString CConfigFile::getInstallerInstalledFilePath() const
|
||||
|
@ -818,7 +828,7 @@ QStringList CConfigFile::getInstallerRequiredFiles() const
|
|||
#endif
|
||||
|
||||
// include current executable
|
||||
files << QFileInfo(QApplication::applicationFilePath()).fileName();
|
||||
files << QFileInfo(getInstallerCurrentFilePath()).fileName();
|
||||
#elif defined(Q_OS_MAC)
|
||||
// everything is in a directory
|
||||
files << "Ryzom Installer.app";
|
||||
|
@ -827,7 +837,7 @@ QStringList CConfigFile::getInstallerRequiredFiles() const
|
|||
files << "ryzom_installer.png";
|
||||
|
||||
// include current executable
|
||||
files << QFileInfo(QApplication::applicationFilePath()).fileName();
|
||||
files << QFileInfo(getInstallerCurrentFilePath()).fileName();
|
||||
#endif
|
||||
|
||||
return files;
|
||||
|
@ -875,7 +885,7 @@ OperationStep CConfigFile::getInstallNextStep() const
|
|||
if (!isRyzomInstalledIn(currentDirectory))
|
||||
{
|
||||
// Ryzom is in the same directory as Ryzom Installer
|
||||
currentDirectory = getApplicationDirectory();
|
||||
currentDirectory = getInstallerCurrentDirPath();
|
||||
|
||||
if (!isRyzomInstalledIn(currentDirectory))
|
||||
{
|
||||
|
@ -972,8 +982,8 @@ OperationStep CConfigFile::getInstallNextStep() const
|
|||
// current installer older, launch the more recent installer
|
||||
case -1: return LaunchInstalledInstaller;
|
||||
|
||||
// continue only if 0
|
||||
default: break;
|
||||
// continue only if 0 and launched Installer is the installed one
|
||||
default: if (getInstallerCurrentDirPath() != getInstallerInstalledFilePath() && QFile::exists(getInstallerInstalledFilePath())) return LaunchInstalledInstaller;
|
||||
}
|
||||
|
||||
// no default profile
|
||||
|
|
|
@ -90,7 +90,6 @@ public:
|
|||
// default directories
|
||||
static QString getCurrentDirectory();
|
||||
static QString getParentDirectory();
|
||||
static QString getApplicationDirectory();
|
||||
static QString getOldInstallationDirectory();
|
||||
static QString getNewInstallationDirectory();
|
||||
static QString getOldInstallationLanguage();
|
||||
|
|
|
@ -63,71 +63,62 @@ bool CFilesCopier::exec()
|
|||
|
||||
FilesToCopy files;
|
||||
|
||||
// create the list of files to copy
|
||||
CFilesCopier::getFilesList(files);
|
||||
|
||||
// copy them
|
||||
return copyFiles(files);
|
||||
}
|
||||
|
||||
void CFilesCopier::getFilesList(FilesToCopy &files)
|
||||
void CFilesCopier::getFile(const QFileInfo &fileInfo, const QDir &srcDir, FilesToCopy &files) const
|
||||
{
|
||||
QDir dir(m_sourceDirectory);
|
||||
// full path to file
|
||||
QString fullPath = fileInfo.absoluteFilePath();
|
||||
|
||||
QFileInfoList entries = dir.entryInfoList(m_includeFilter);
|
||||
// full path where to copy file
|
||||
QString dstPath = m_destinationDirectory + "/" + srcDir.relativeFilePath(fullPath);
|
||||
|
||||
if (fileInfo.isDir())
|
||||
{
|
||||
// create directory
|
||||
QDir().mkpath(dstPath);
|
||||
|
||||
QDir subDir(fullPath);
|
||||
|
||||
// get list of all files in directory
|
||||
QFileInfoList entries = subDir.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot);
|
||||
|
||||
// proces seach file recursively
|
||||
foreach(const QFileInfo &entry, entries)
|
||||
{
|
||||
getFile(entry, srcDir, files);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// add the file to list with all useful information
|
||||
FileToCopy file;
|
||||
file.filename = fileInfo.fileName();
|
||||
file.src = fileInfo.filePath();
|
||||
file.dst = dstPath;
|
||||
file.size = fileInfo.size();
|
||||
file.date = fileInfo.lastModified().toTime_t();
|
||||
file.permissions = fileInfo.permissions();
|
||||
|
||||
files << file;
|
||||
}
|
||||
}
|
||||
|
||||
void CFilesCopier::getFilesList(FilesToCopy &files) const
|
||||
{
|
||||
QDir srcDir(m_sourceDirectory);
|
||||
|
||||
// only copy all files from filter
|
||||
QFileInfoList entries = srcDir.entryInfoList(m_includeFilter);
|
||||
|
||||
foreach(const QFileInfo &entry, entries)
|
||||
{
|
||||
QString fullPath = entry.absoluteFilePath();
|
||||
|
||||
QString dstPath = m_destinationDirectory + "/" + dir.relativeFilePath(fullPath);
|
||||
|
||||
if (entry.isDir())
|
||||
{
|
||||
QDir().mkpath(dstPath);
|
||||
|
||||
QDir subDir(fullPath);
|
||||
|
||||
QDirIterator it(subDir, QDirIterator::Subdirectories);
|
||||
|
||||
while (it.hasNext())
|
||||
{
|
||||
fullPath = it.next();
|
||||
|
||||
if (it.fileName().startsWith('.')) continue;
|
||||
|
||||
QFileInfo fileInfo = it.fileInfo();
|
||||
|
||||
dstPath = m_destinationDirectory + "/" + dir.relativeFilePath(fullPath);
|
||||
|
||||
if (fileInfo.isDir())
|
||||
{
|
||||
QDir().mkpath(dstPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
FileToCopy file;
|
||||
file.filename = it.fileName();
|
||||
file.src = it.filePath();
|
||||
file.dst = dstPath;
|
||||
file.size = it.fileInfo().size();
|
||||
file.date = it.fileInfo().lastModified().toTime_t();
|
||||
file.permissions = it.fileInfo().permissions();
|
||||
|
||||
files << file;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FileToCopy file;
|
||||
file.filename = entry.fileName();
|
||||
file.src = entry.filePath();
|
||||
file.dst = dstPath;
|
||||
file.size = entry.size();
|
||||
file.date = entry.lastModified().toTime_t();
|
||||
file.permissions = entry.permissions();
|
||||
|
||||
files << file;
|
||||
}
|
||||
getFile(entry, srcDir, files);
|
||||
}
|
||||
|
||||
// copy additional files
|
||||
|
@ -135,18 +126,7 @@ void CFilesCopier::getFilesList(FilesToCopy &files)
|
|||
{
|
||||
QFileInfo fileInfo(fullpath);
|
||||
|
||||
if (fileInfo.isFile())
|
||||
{
|
||||
FileToCopy file;
|
||||
file.filename = fileInfo.fileName();
|
||||
file.src = fileInfo.filePath();
|
||||
file.dst = m_destinationDirectory + "/" + fileInfo.fileName();
|
||||
file.size = fileInfo.size();
|
||||
file.date = fileInfo.lastModified().toTime_t();
|
||||
file.permissions = fileInfo.permissions();
|
||||
|
||||
files << file;
|
||||
}
|
||||
getFile(fileInfo, srcDir, files);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,7 +166,7 @@ bool CFilesCopier::copyFiles(const FilesToCopy &files)
|
|||
|
||||
if (!QFile::copy(file.src, file.dst))
|
||||
{
|
||||
if (m_listener) m_listener->operationFail(QApplication::tr("Unable to copy file %1").arg(file.src));
|
||||
if (m_listener) m_listener->operationFail(QApplication::tr("Unable to copy file %1 to %2").arg(file.src).arg(file.dst));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,9 @@ protected:
|
|||
|
||||
typedef QList<FileToCopy> FilesToCopy;
|
||||
|
||||
void getFilesList(FilesToCopy &files);
|
||||
void getFile(const QFileInfo &info, const QDir &srcDir, FilesToCopy &files) const;
|
||||
void getFilesList(FilesToCopy &files) const;
|
||||
|
||||
bool copyFiles(const FilesToCopy &files);
|
||||
|
||||
IOperationProgressListener *m_listener;
|
||||
|
|
|
@ -180,7 +180,7 @@ int main(int argc, char *argv[])
|
|||
// copy installer and required files to TEMP directory
|
||||
if (QDir().mkdir(tempPath) && copyInstallerFiles(config.getInstallerRequiredFiles(), tempPath))
|
||||
{
|
||||
QString tempFile = tempPath + "/" + QFileInfo(QApplication::applicationFilePath()).fileName();
|
||||
QString tempFile = tempPath + "/" + QFileInfo(getInstallerCurrentFilePath()).fileName();
|
||||
|
||||
// launch copy in TEMP directory with same arguments
|
||||
if (QProcess::startDetached(tempFile, QApplication::arguments())) return 0;
|
||||
|
|
|
@ -38,7 +38,7 @@ CMigrateDialog::CMigrateDialog():QDialog()
|
|||
if (!CConfigFile::getInstance()->isRyzomInstalledIn(m_currentDirectory))
|
||||
{
|
||||
// Ryzom is in the same directory as Ryzom Installer
|
||||
m_currentDirectory = CConfigFile::getInstance()->getApplicationDirectory();
|
||||
m_currentDirectory = CConfigFile::getInstance()->getInstallerCurrentDirPath();
|
||||
|
||||
if (!CConfigFile::getInstance()->isRyzomInstalledIn(m_currentDirectory))
|
||||
{
|
||||
|
|
|
@ -729,18 +729,28 @@ void COperationDialog::copyInstaller()
|
|||
|
||||
// rename old client to installer
|
||||
|
||||
QString oldInstallerFullPath = QApplication::applicationFilePath();
|
||||
QString oldInstallerFullPath = config->getInstallerCurrentFilePath();
|
||||
QString newInstallerFullPath = config->getInstallerInstalledFilePath();
|
||||
|
||||
if (!newInstallerFullPath.isEmpty())
|
||||
{
|
||||
QString srcDir = config->getSrcServerDirectory();
|
||||
|
||||
if (srcDir.isEmpty()) srcDir = config->getInstallerCurrentDirPath();
|
||||
|
||||
// always copy new installers
|
||||
CFilesCopier copier(this);
|
||||
copier.setIncludeFilter(config->getInstallerRequiredFiles());
|
||||
#ifdef Q_OS_WIN32
|
||||
copier.addFile(oldInstallerFullPath);
|
||||
copier.setSourceDirectory(config->getSrcServerDirectory().isEmpty() ? QApplication::applicationDirPath():config->getSrcServerDirectory());
|
||||
#endif
|
||||
copier.setSourceDirectory(srcDir);
|
||||
copier.setDestinationDirectory(config->getInstallationDirectory());
|
||||
copier.exec();
|
||||
|
||||
if (!copier.exec()) return;
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
// only happens under Windows in Debug or when migrating
|
||||
|
||||
// copied file
|
||||
oldInstallerFullPath = config->getInstallationDirectory() + "/" + QFileInfo(oldInstallerFullPath).fileName();
|
||||
|
@ -754,6 +764,7 @@ void COperationDialog::copyInstaller()
|
|||
// rename new installer with final name
|
||||
QFile::rename(oldInstallerFullPath, newInstallerFullPath);
|
||||
}
|
||||
#endif
|
||||
|
||||
// create menu directory if defined
|
||||
QString path = config->getMenuDirectory();
|
||||
|
|
Loading…
Reference in a new issue