mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-24 18:08:44 +00:00
Merge with develop
--HG-- branch : compatibility-develop
This commit is contained in:
commit
7363803b2c
13 changed files with 121 additions and 123 deletions
|
@ -56,33 +56,37 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||||
LIST(APPEND _FLAGS " -I\"${item}\"")
|
LIST(APPEND _FLAGS " -I\"${item}\"")
|
||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
|
|
||||||
|
# NOTE: As cmake files (eg FindQT4) may now use generator expressions around their defines that evaluate
|
||||||
|
# to an empty string, wrap all "items" in an expression that outputs a -D IFF the generated
|
||||||
|
# expression is not empty.
|
||||||
|
|
||||||
# Required for CMake 2.6
|
# Required for CMake 2.6
|
||||||
SET(GLOBAL_DEFINITIONS)
|
SET(GLOBAL_DEFINITIONS)
|
||||||
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS)
|
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS)
|
||||||
IF(DEFINITIONS)
|
IF(DEFINITIONS)
|
||||||
FOREACH(item ${DEFINITIONS})
|
FOREACH(item ${DEFINITIONS})
|
||||||
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
LIST(APPEND GLOBAL_DEFINITIONS "$<$<BOOL:${item}>:-D$<JOIN:${item},-D>>")
|
||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS_${_UPPER_BUILD})
|
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS_${_UPPER_BUILD})
|
||||||
IF(DEFINITIONS)
|
IF(DEFINITIONS)
|
||||||
FOREACH(item ${DEFINITIONS})
|
FOREACH(item ${DEFINITIONS})
|
||||||
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
LIST(APPEND GLOBAL_DEFINITIONS "$<$<BOOL:${item}>:-D$<JOIN:${item},-D>>")
|
||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS)
|
GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS)
|
||||||
IF(DEFINITIONS)
|
IF(DEFINITIONS)
|
||||||
FOREACH(item ${DEFINITIONS})
|
FOREACH(item ${DEFINITIONS})
|
||||||
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
LIST(APPEND GLOBAL_DEFINITIONS "$<$<BOOL:${item}>:-D$<JOIN:${item},-D>>")
|
||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS_${_UPPER_BUILD})
|
GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS_${_UPPER_BUILD})
|
||||||
IF(DEFINITIONS)
|
IF(DEFINITIONS)
|
||||||
FOREACH(item ${DEFINITIONS})
|
FOREACH(item ${DEFINITIONS})
|
||||||
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
LIST(APPEND GLOBAL_DEFINITIONS "$<$<BOOL:${item}>:-D$<JOIN:${item},-D>>")
|
||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
@ -106,14 +110,14 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||||
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS)
|
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS)
|
||||||
IF(DEFINITIONS)
|
IF(DEFINITIONS)
|
||||||
FOREACH(item ${DEFINITIONS})
|
FOREACH(item ${DEFINITIONS})
|
||||||
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
LIST(APPEND GLOBAL_DEFINITIONS "$<$<BOOL:${item}>:-D$<JOIN:${item},-D>>")
|
||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS_${_UPPER_BUILD})
|
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS_${_UPPER_BUILD})
|
||||||
IF(DEFINITIONS)
|
IF(DEFINITIONS)
|
||||||
FOREACH(item ${DEFINITIONS})
|
FOREACH(item ${DEFINITIONS})
|
||||||
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
LIST(APPEND GLOBAL_DEFINITIONS "$<$<BOOL:${item}>:-D$<JOIN:${item},-D>>")
|
||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
@ -135,10 +139,7 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||||
|
|
||||||
IF(_DEFINITIONS)
|
IF(_DEFINITIONS)
|
||||||
FOREACH(item ${_DEFINITIONS})
|
FOREACH(item ${_DEFINITIONS})
|
||||||
# don't use dynamic expressions
|
LIST(APPEND GLOBAL_DEFINITIONS "$<$<BOOL:${item}>:-D$<JOIN:${item},-D>>")
|
||||||
IF(NOT item MATCHES "\\$<")
|
|
||||||
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
|
||||||
ENDIF()
|
|
||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
@ -149,7 +150,7 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||||
IF(GLOBAL_DEFINITIONS MATCHES "QT_CORE_LIB")
|
IF(GLOBAL_DEFINITIONS MATCHES "QT_CORE_LIB")
|
||||||
# Hack to define missing QT_NO_DEBUG with Qt 5.2
|
# Hack to define missing QT_NO_DEBUG with Qt 5.2
|
||||||
IF(_UPPER_BUILD STREQUAL "RELEASE")
|
IF(_UPPER_BUILD STREQUAL "RELEASE")
|
||||||
LIST(APPEND GLOBAL_DEFINITIONS " -DQT_NO_DEBUG")
|
LIST(APPEND GLOBAL_DEFINITIONS "-DQT_NO_DEBUG")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
# Qt5_POSITION_INDEPENDENT_CODE should be true if Qt was compiled with PIC
|
# Qt5_POSITION_INDEPENDENT_CODE should be true if Qt was compiled with PIC
|
||||||
|
@ -162,8 +163,6 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
LIST(APPEND _FLAGS " ${GLOBAL_DEFINITIONS}")
|
|
||||||
|
|
||||||
IF(CMAKE_VERSION VERSION_LESS "3.3.0")
|
IF(CMAKE_VERSION VERSION_LESS "3.3.0")
|
||||||
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
|
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
|
||||||
GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS)
|
GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS)
|
||||||
|
@ -180,6 +179,9 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||||
SEPARATE_ARGUMENTS(_FLAGS)
|
SEPARATE_ARGUMENTS(_FLAGS)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
# Already in list form and items may contain non-leading spaces that should not be split on
|
||||||
|
LIST(INSERT _FLAGS 0 "${GLOBAL_DEFINITIONS}")
|
||||||
|
|
||||||
IF(CLANG)
|
IF(CLANG)
|
||||||
# Determining all architectures and get common flags
|
# Determining all architectures and get common flags
|
||||||
SET(_ARCH_NEXT)
|
SET(_ARCH_NEXT)
|
||||||
|
|
|
@ -1429,22 +1429,27 @@ int getLastError()
|
||||||
std::string formatErrorMessage(int errorCode)
|
std::string formatErrorMessage(int errorCode)
|
||||||
{
|
{
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
LPVOID lpMsgBuf;
|
LPVOID lpMsgBuf = NULL;
|
||||||
FormatMessage(
|
DWORD len = FormatMessageW(
|
||||||
FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||||
FORMAT_MESSAGE_FROM_SYSTEM |
|
FORMAT_MESSAGE_FROM_SYSTEM |
|
||||||
FORMAT_MESSAGE_IGNORE_INSERTS,
|
FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||||
NULL,
|
NULL,
|
||||||
errorCode,
|
errorCode,
|
||||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
|
||||||
(LPTSTR) &lpMsgBuf,
|
(LPWSTR) &lpMsgBuf,
|
||||||
0,
|
0,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
string ret = (char*)lpMsgBuf;
|
// empty buffer, an error occured
|
||||||
|
if (len == 0) return toString("FormatMessage returned error %d", getLastError());
|
||||||
|
|
||||||
|
// convert wchar_t* to std::string
|
||||||
|
string ret = wideToUtf8(lpMsgBuf);
|
||||||
|
|
||||||
// Free the buffer.
|
// Free the buffer.
|
||||||
LocalFree( lpMsgBuf );
|
LocalFree(lpMsgBuf);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -505,59 +505,6 @@ QString CConfigFile::getParentDirectory()
|
||||||
return current.absolutePath();
|
return current.absolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CConfigFile::getOldInstallationDirectory()
|
|
||||||
{
|
|
||||||
// HKEY_CURRENT_USER/SOFTWARE/Nevrax/RyzomInstall/InstallId=1917716796 (string)
|
|
||||||
#if defined(Q_OS_WIN)
|
|
||||||
// NSIS previous official installer
|
|
||||||
#ifdef Q_OS_WIN64
|
|
||||||
// use WOW6432Node in 64 bits (64 bits OS and 64 bits Installer) because Ryzom old installer was in 32 bits
|
|
||||||
QSettings settings("HKEY_LOCAL_MACHINE\\Software\\WOW6432Node\\Nevrax\\Ryzom", QSettings::NativeFormat);
|
|
||||||
#else
|
|
||||||
QSettings settings("HKEY_LOCAL_MACHINE\\Software\\Nevrax\\Ryzom", QSettings::NativeFormat);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (settings.contains("Ryzom Install Path"))
|
|
||||||
{
|
|
||||||
return QDir::fromNativeSeparators(settings.value("Ryzom Install Path").toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
// check default directory if registry key not found
|
|
||||||
return CConfigFile::has64bitsOS() ? "C:/Program Files (x86)/Ryzom":"C:/Program Files/Ryzom";
|
|
||||||
#elif defined(Q_OS_MAC)
|
|
||||||
return "/Applications/Ryzom.app";
|
|
||||||
#else
|
|
||||||
return QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/.ryzom";
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CConfigFile::getOldInstallationLanguage()
|
|
||||||
{
|
|
||||||
#if defined(Q_OS_WIN)
|
|
||||||
// NSIS previous official installer
|
|
||||||
#ifdef Q_OS_WIN64
|
|
||||||
// use WOW6432Node in 64 bits (64 bits OS and 64 bits Installer) because Ryzom old installer was in 32 bits
|
|
||||||
QSettings settings("HKEY_LOCAL_MACHINE\\Software\\WOW6432Node\\Nevrax\\Ryzom", QSettings::NativeFormat);
|
|
||||||
#else
|
|
||||||
QSettings settings("HKEY_LOCAL_MACHINE\\Software\\Nevrax\\Ryzom", QSettings::NativeFormat);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QString key = "Language";
|
|
||||||
|
|
||||||
if (settings.contains(key))
|
|
||||||
{
|
|
||||||
QString languageCode = settings.value(key).toString();
|
|
||||||
|
|
||||||
// 1036 = French (France), 1033 = English (USA), 1031 = German
|
|
||||||
if (languageCode == "1036") return "fr";
|
|
||||||
if (languageCode == "1031") return "de";
|
|
||||||
if (languageCode == "1033") return "en";
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CConfigFile::getNewInstallationLanguage()
|
QString CConfigFile::getNewInstallationLanguage()
|
||||||
{
|
{
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
|
@ -745,6 +692,9 @@ int CConfigFile::compareInstallersVersion() const
|
||||||
|
|
||||||
QString installedVersion = getVersionFromExecutable(installerDst);
|
QString installedVersion = getVersionFromExecutable(installerDst);
|
||||||
|
|
||||||
|
// if unable to get version, copy it
|
||||||
|
if (installedVersion.isEmpty()) return 1;
|
||||||
|
|
||||||
nlinfo("%s version is %s", Q2C(installerDst), Q2C(installedVersion));
|
nlinfo("%s version is %s", Q2C(installerDst), Q2C(installedVersion));
|
||||||
|
|
||||||
QString newVersion = QApplication::applicationVersion();
|
QString newVersion = QApplication::applicationVersion();
|
||||||
|
@ -892,8 +842,13 @@ OperationStep CConfigFile::getInstallNextStep() const
|
||||||
// only show wizard if installation directory undefined
|
// only show wizard if installation directory undefined
|
||||||
if (getInstallationDirectory().isEmpty())
|
if (getInstallationDirectory().isEmpty())
|
||||||
{
|
{
|
||||||
|
QString currentDirectory;
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
|
// only under Windows
|
||||||
|
|
||||||
// if launched from current directory, it means we just patched files
|
// if launched from current directory, it means we just patched files
|
||||||
QString currentDirectory = getCurrentDirectory();
|
currentDirectory = getCurrentDirectory();
|
||||||
|
|
||||||
if (!isRyzomInstalledIn(currentDirectory))
|
if (!isRyzomInstalledIn(currentDirectory))
|
||||||
{
|
{
|
||||||
|
@ -905,6 +860,7 @@ OperationStep CConfigFile::getInstallNextStep() const
|
||||||
currentDirectory.clear();
|
currentDirectory.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// install or migrate depending if Ryzom was found in current directory
|
// install or migrate depending if Ryzom was found in current directory
|
||||||
return currentDirectory.isEmpty() ? ShowInstallWizard:ShowMigrateWizard;
|
return currentDirectory.isEmpty() ? ShowInstallWizard:ShowMigrateWizard;
|
||||||
|
|
|
@ -90,9 +90,7 @@ public:
|
||||||
// default directories
|
// default directories
|
||||||
static QString getCurrentDirectory();
|
static QString getCurrentDirectory();
|
||||||
static QString getParentDirectory();
|
static QString getParentDirectory();
|
||||||
static QString getOldInstallationDirectory();
|
|
||||||
static QString getNewInstallationDirectory();
|
static QString getNewInstallationDirectory();
|
||||||
static QString getOldInstallationLanguage();
|
|
||||||
static QString getNewInstallationLanguage();
|
static QString getNewInstallationLanguage();
|
||||||
|
|
||||||
// status of installation
|
// status of installation
|
||||||
|
|
|
@ -182,12 +182,12 @@ bool CFilesCopier::copyFiles(const FilesToCopy &files)
|
||||||
|
|
||||||
if (!QFile::setPermissions(file.dst, file.permissions))
|
if (!QFile::setPermissions(file.dst, file.permissions))
|
||||||
{
|
{
|
||||||
qDebug() << "Unable to change permissions of " << file.dst;
|
nlwarning("Unable to change permissions of %s", Q2C(file.dst));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!NLMISC::CFile::setFileModificationDate(qToUtf8(file.dst), file.date))
|
if (!NLMISC::CFile::setFileModificationDate(qToUtf8(file.dst), file.date))
|
||||||
{
|
{
|
||||||
qDebug() << "Unable to change date of " << file.dst;
|
nlwarning("Unable to change date of %s", Q2C(file.dst));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -289,7 +289,7 @@ bool CFilesExtractor::exec()
|
||||||
return extractBnp();
|
return extractBnp();
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "Unsupported format";
|
nlwarning("Unsupported format");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,6 +319,8 @@ bool CFilesExtractor::extract7z()
|
||||||
|
|
||||||
if (!inFile.open())
|
if (!inFile.open())
|
||||||
{
|
{
|
||||||
|
nlwarning("Unable to open %s", Q2C(m_sourceFile));
|
||||||
|
|
||||||
if (m_listener) m_listener->operationFail(QApplication::tr("Unable to open %1").arg(m_sourceFile));
|
if (m_listener) m_listener->operationFail(QApplication::tr("Unable to open %1").arg(m_sourceFile));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -451,14 +453,21 @@ bool CFilesExtractor::extract7z()
|
||||||
|
|
||||||
if (res != SZ_OK) break;
|
if (res != SZ_OK) break;
|
||||||
|
|
||||||
|
QString destSubPath = QFileInfo(destPath).absolutePath();
|
||||||
|
|
||||||
// create file directory
|
// create file directory
|
||||||
QDir().mkpath(QFileInfo(destPath).absolutePath());
|
if (!QDir().mkpath(destSubPath))
|
||||||
|
{
|
||||||
|
nlwarning("Unable to create directory %s", Q2C(destSubPath));
|
||||||
|
}
|
||||||
|
|
||||||
// create file
|
// create file
|
||||||
QFile outFile(destPath);
|
QFile outFile(destPath);
|
||||||
|
|
||||||
if (!outFile.open(QFile::WriteOnly))
|
if (!outFile.open(QFile::WriteOnly))
|
||||||
{
|
{
|
||||||
|
nlwarning("Unable to open file %s", Q2C(destPath));
|
||||||
|
|
||||||
error = QApplication::tr("Unable to open output file %1").arg(destPath);
|
error = QApplication::tr("Unable to open output file %1").arg(destPath);
|
||||||
res = SZ_ERROR_FAIL;
|
res = SZ_ERROR_FAIL;
|
||||||
break;
|
break;
|
||||||
|
@ -480,6 +489,8 @@ bool CFilesExtractor::extract7z()
|
||||||
|
|
||||||
if (offset != outSizeProcessed)
|
if (offset != outSizeProcessed)
|
||||||
{
|
{
|
||||||
|
nlwarning("Unable to write output file %s (%u bytes written but expecting %u bytes)", Q2C(destPath), (uint32)offset, (uint32)outSizeProcessed);
|
||||||
|
|
||||||
error = QApplication::tr("Unable to write output file %1 (%2 bytes written but expecting %3 bytes)").arg(destPath).arg(offset).arg(outSizeProcessed);
|
error = QApplication::tr("Unable to write output file %1 (%2 bytes written but expecting %3 bytes)").arg(destPath).arg(offset).arg(outSizeProcessed);
|
||||||
res = SZ_ERROR_FAIL;
|
res = SZ_ERROR_FAIL;
|
||||||
break;
|
break;
|
||||||
|
@ -500,7 +511,7 @@ bool CFilesExtractor::extract7z()
|
||||||
// set modification time
|
// set modification time
|
||||||
if (!NLMISC::CFile::setFileModificationDate(qToUtf8(destPath), modificationTime))
|
if (!NLMISC::CFile::setFileModificationDate(qToUtf8(destPath), modificationTime))
|
||||||
{
|
{
|
||||||
qDebug() << "Unable to change date of " << destPath;
|
nlwarning("Unable to change date of %s", Q2C(destPath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -571,12 +582,16 @@ bool CFilesExtractor::extractZip()
|
||||||
|
|
||||||
if (!baseDir.mkpath(fi.filePath))
|
if (!baseDir.mkpath(fi.filePath))
|
||||||
{
|
{
|
||||||
if (m_listener) m_listener->operationFail(QApplication::tr("Unable to create directory %1").arg(absPath));
|
nlwarning("Unable to create directory %s", Q2C(fi.filePath));
|
||||||
|
|
||||||
|
if (m_listener) m_listener->operationFail(QApplication::tr("Unable to create directory %1").arg(fi.filePath));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!QFile::setPermissions(absPath, fi.permissions))
|
if (!QFile::setPermissions(absPath, fi.permissions))
|
||||||
{
|
{
|
||||||
|
nlwarning("Unable to change permissions of %s", Q2C(absPath));
|
||||||
|
|
||||||
if (m_listener) m_listener->operationFail(QApplication::tr("Unable to set permissions of %1").arg(absPath));
|
if (m_listener) m_listener->operationFail(QApplication::tr("Unable to set permissions of %1").arg(absPath));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -609,19 +624,25 @@ bool CFilesExtractor::extractZip()
|
||||||
|
|
||||||
if (!f.open(QIODevice::WriteOnly))
|
if (!f.open(QIODevice::WriteOnly))
|
||||||
{
|
{
|
||||||
|
nlwarning("Unable to open %s", Q2C(absPath));
|
||||||
|
|
||||||
if (m_listener) m_listener->operationFail(QApplication::tr("Unable to open %1").arg(absPath));
|
if (m_listener) m_listener->operationFail(QApplication::tr("Unable to open %1").arg(absPath));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentSize += f.write(reader.fileData(fi.filePath));
|
currentSize += f.write(reader.fileData(fi.filePath));
|
||||||
|
|
||||||
f.setPermissions(fi.permissions);
|
if (!f.setPermissions(fi.permissions))
|
||||||
|
{
|
||||||
|
nlwarning("Unable to change permissions of %s", Q2C(absPath));
|
||||||
|
}
|
||||||
|
|
||||||
f.close();
|
f.close();
|
||||||
|
|
||||||
// set the right modification date
|
// set the right modification date
|
||||||
if (!NLMISC::CFile::setFileModificationDate(qToUtf8(absPath), fi.lastModified.toTime_t()))
|
if (!NLMISC::CFile::setFileModificationDate(qToUtf8(absPath), fi.lastModified.toTime_t()))
|
||||||
{
|
{
|
||||||
qDebug() << "Unable to change date of " << absPath;
|
nlwarning("Unable to change date of %s", Q2C(absPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_listener) m_listener->operationProgress(currentSize, QFileInfo(absPath).fileName());
|
if (m_listener) m_listener->operationProgress(currentSize, QFileInfo(absPath).fileName());
|
||||||
|
@ -692,18 +713,26 @@ bool CFilesExtractor::extractBnp()
|
||||||
}
|
}
|
||||||
catch(const NLMISC::EDiskFullError &e)
|
catch(const NLMISC::EDiskFullError &e)
|
||||||
{
|
{
|
||||||
|
nlwarning("Disk full when extracting %s to %s", Q2C(m_sourceFile), Q2C(m_destinationDirectory));
|
||||||
|
|
||||||
error = QApplication::tr("disk full");
|
error = QApplication::tr("disk full");
|
||||||
}
|
}
|
||||||
catch(const NLMISC::EWriteError &e)
|
catch(const NLMISC::EWriteError &e)
|
||||||
{
|
{
|
||||||
|
nlwarning("Write error when extracting %s to %s", Q2C(m_sourceFile), Q2C(m_destinationDirectory));
|
||||||
|
|
||||||
error = QApplication::tr("unable to write %1").arg(qFromUtf8(e.Filename));
|
error = QApplication::tr("unable to write %1").arg(qFromUtf8(e.Filename));
|
||||||
}
|
}
|
||||||
catch(const NLMISC::EReadError &e)
|
catch(const NLMISC::EReadError &e)
|
||||||
{
|
{
|
||||||
|
nlwarning("Read error when extracting %s to %s", Q2C(m_sourceFile), Q2C(m_destinationDirectory));
|
||||||
|
|
||||||
error = QApplication::tr("unable to read %1").arg(qFromUtf8(e.Filename));
|
error = QApplication::tr("unable to read %1").arg(qFromUtf8(e.Filename));
|
||||||
}
|
}
|
||||||
catch(const std::exception &e)
|
catch(const std::exception &e)
|
||||||
{
|
{
|
||||||
|
nlwarning("Unknown exception when extracting %s to %s", Q2C(m_sourceFile), Q2C(m_destinationDirectory));
|
||||||
|
|
||||||
error = QApplication::tr("failed (%1)").arg(qFromUtf8(e.what()));
|
error = QApplication::tr("failed (%1)").arg(qFromUtf8(e.what()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,13 +64,13 @@ bool copyInstallerFiles(const QStringList &files, const QString &destination)
|
||||||
{
|
{
|
||||||
if (!QFile::remove(dstPath))
|
if (!QFile::remove(dstPath))
|
||||||
{
|
{
|
||||||
qDebug() << "Unable to delete" << dstPath;
|
nlwarning("Unable to delete %s", Q2C(dstPath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!QFile::copy(srcPath, dstPath))
|
if (!QFile::copy(srcPath, dstPath))
|
||||||
{
|
{
|
||||||
qDebug() << "Unable to copy" << srcPath << "to" << dstPath;
|
nlwarning("Unable to copy %s to %s", Q2C(srcPath), Q2C(dstPath));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -248,12 +248,15 @@ int main(int argc, char *argv[])
|
||||||
if (step == ShowMigrateWizard)
|
if (step == ShowMigrateWizard)
|
||||||
{
|
{
|
||||||
nlinfo("Display migration dialog");
|
nlinfo("Display migration dialog");
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
CMigrateDialog dialog;
|
CMigrateDialog dialog;
|
||||||
|
|
||||||
if (!dialog.exec()) return 1;
|
if (!dialog.exec()) return 1;
|
||||||
|
|
||||||
step = config.getInstallNextStep();
|
step = config.getInstallNextStep();
|
||||||
|
#else
|
||||||
|
nlwarning("Migration disabled under Linux and OS X");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (step == ShowInstallWizard)
|
else if (step == ShowInstallWizard)
|
||||||
{
|
{
|
||||||
|
@ -307,6 +310,8 @@ int main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (QProcess::startDetached(config.getInstallerInstalledFilePath())) return 0;
|
if (QProcess::startDetached(config.getInstallerInstalledFilePath())) return 0;
|
||||||
|
|
||||||
|
nlwarning("Unable to restart Installer %s", Q2C(config.getInstallerInstalledFilePath()));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,9 @@
|
||||||
|
|
||||||
#include "stdpch.h"
|
#include "stdpch.h"
|
||||||
#include "migratedialog.h"
|
#include "migratedialog.h"
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
|
|
||||||
#include "configfile.h"
|
#include "configfile.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
@ -49,12 +52,6 @@ CMigrateDialog::CMigrateDialog():QDialog()
|
||||||
// update default destination
|
// update default destination
|
||||||
onDestinationDefaultButtonClicked();
|
onDestinationDefaultButtonClicked();
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
// only 64 bits for OS X
|
|
||||||
clientArchGroupBox->setVisible(false);
|
|
||||||
clientArch64RadioButton->setChecked(true);
|
|
||||||
clientArch32RadioButton->setChecked(false);
|
|
||||||
#elif defined(Q_OS_WIN32)
|
|
||||||
// both 32 and 64 bits are working under Windows 64 bits
|
// both 32 and 64 bits are working under Windows 64 bits
|
||||||
|
|
||||||
// check whether OS architecture is 32 or 64 bits
|
// check whether OS architecture is 32 or 64 bits
|
||||||
|
@ -72,22 +69,6 @@ CMigrateDialog::CMigrateDialog():QDialog()
|
||||||
clientArch64RadioButton->setChecked(false);
|
clientArch64RadioButton->setChecked(false);
|
||||||
clientArch32RadioButton->setChecked(true);
|
clientArch32RadioButton->setChecked(true);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
// only use the current architecture for Linux
|
|
||||||
|
|
||||||
clientArchGroupBox->setVisible(false);
|
|
||||||
|
|
||||||
#ifdef _LP64
|
|
||||||
// only 64 bits is available
|
|
||||||
clientArch64RadioButton->setChecked(true);
|
|
||||||
clientArch32RadioButton->setChecked(false);
|
|
||||||
#else
|
|
||||||
// only 32 bits is available
|
|
||||||
clientArch64RadioButton->setChecked(false);
|
|
||||||
clientArch32RadioButton->setChecked(true);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const CServer &server = CConfigFile::getInstance()->getServer();
|
const CServer &server = CConfigFile::getInstance()->getServer();
|
||||||
|
|
||||||
|
@ -198,3 +179,5 @@ void CMigrateDialog::accept()
|
||||||
|
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
#ifndef MIGRATEDIALOG_H
|
#ifndef MIGRATEDIALOG_H
|
||||||
#define MIGRATEDIALOG_H
|
#define MIGRATEDIALOG_H
|
||||||
|
|
||||||
|
#if defined(Q_OS_WIN32) || defined(Q_MOC_RUN)
|
||||||
|
|
||||||
#include "ui_migratedialog.h"
|
#include "ui_migratedialog.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,3 +50,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -141,7 +141,7 @@ void COperationDialog::processInstallNextStep()
|
||||||
|
|
||||||
if (m_operationStepCounter > 10)
|
if (m_operationStepCounter > 10)
|
||||||
{
|
{
|
||||||
qDebug() << "possible infinite loop" << m_operationStep << m_operationStepCounter;
|
nlwarning("Possible infinite loop, step %s %d times", Q2C(stepToString(m_operationStep)), m_operationStepCounter);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(step)
|
switch(step)
|
||||||
|
@ -205,7 +205,8 @@ void COperationDialog::processInstallNextStep()
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// cases already managed in main.cpp
|
// cases already managed in main.cpp
|
||||||
qDebug() << "Shouldn't happen, step" << step;
|
nlwarning("Shouldn't happen, step %s", Q2C(stepToString(step)));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -706,14 +707,14 @@ void COperationDialog::launchUpgradeScript(const QString &directory, const QStri
|
||||||
|
|
||||||
if (!QFile::setPermissions(upgradeScript, permissions))
|
if (!QFile::setPermissions(upgradeScript, permissions))
|
||||||
{
|
{
|
||||||
qDebug() << "Unable to set executable flag to" << upgradeScript;
|
nlwarning("Unable to set executable flag to %s", Q2C(upgradeScript));
|
||||||
}
|
}
|
||||||
|
|
||||||
process.start(upgradeScript);
|
process.start(upgradeScript);
|
||||||
|
|
||||||
while (process.waitForFinished())
|
while (process.waitForFinished())
|
||||||
{
|
{
|
||||||
qDebug() << "waiting";
|
nlwarning("Waiting end of %s", Q2C(upgradeScript));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -764,7 +765,7 @@ void COperationDialog::copyInstaller()
|
||||||
|
|
||||||
if (!path.isEmpty() && !QDir().mkpath(path))
|
if (!path.isEmpty() && !QDir().mkpath(path))
|
||||||
{
|
{
|
||||||
qDebug() << "Unable to create directory" << path;
|
nlwarning("Unable to create directory %s", Q2C(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
// create installer link in menu
|
// create installer link in menu
|
||||||
|
@ -785,7 +786,7 @@ void COperationDialog::copyInstaller()
|
||||||
// create icon if not exists
|
// create icon if not exists
|
||||||
if (!QFile::exists(icon) && !writeResource(":/icons/ryzom.png", icon))
|
if (!QFile::exists(icon) && !writeResource(":/icons/ryzom.png", icon))
|
||||||
{
|
{
|
||||||
qDebug() << "Unable to create" << icon;
|
nlwarning("Unable to create icon %s", Q2C(icon));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1215,7 +1216,7 @@ void COperationDialog::deleteComponentsDownloadedFiles()
|
||||||
{
|
{
|
||||||
if (!QFile::remove(dir.filePath(file)))
|
if (!QFile::remove(dir.filePath(file)))
|
||||||
{
|
{
|
||||||
qDebug() << "Unable to delete" << file;
|
nlwarning("Unable to delete file %s", Q2C(file));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ void CProfile::createShortcuts() const
|
||||||
// create desktop shortcut
|
// create desktop shortcut
|
||||||
if (!createShortcut(shortcut, name, exe, profileArguments, icon, workingDir))
|
if (!createShortcut(shortcut, name, exe, profileArguments, icon, workingDir))
|
||||||
{
|
{
|
||||||
qDebug() << "Unable to create desktop shortcut";
|
nlwarning("Unable to create desktop shortcut");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ void CProfile::createShortcuts() const
|
||||||
// create menu shortcut
|
// create menu shortcut
|
||||||
if (!createShortcut(shortcut, name, exe, profileArguments, icon, workingDir))
|
if (!createShortcut(shortcut, name, exe, profileArguments, icon, workingDir))
|
||||||
{
|
{
|
||||||
qDebug() << "Unable to create shortcut for client in menu";
|
nlwarning("Unable to create shortcut for client in menu");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ void CProfilesDialog::onDeleteProfile()
|
||||||
|
|
||||||
void CProfilesDialog::onProfileClicked(const QModelIndex &index)
|
void CProfilesDialog::onProfileClicked(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
qDebug() << "clicked on" << index;
|
nlwarning("Clicked on profile %d", index.row());
|
||||||
|
|
||||||
displayProfile(index.row());
|
displayProfile(index.row());
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,7 +192,7 @@ bool createShortcut(const QString &shortcut, const QString &name, const QString
|
||||||
|
|
||||||
if (FAILED(hres))
|
if (FAILED(hres))
|
||||||
{
|
{
|
||||||
qDebug() << "Unable to create shortcut" << path;
|
nlwarning("Unable to create shortcut %s", Q2C(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
ppf->Release();
|
ppf->Release();
|
||||||
|
@ -409,26 +409,41 @@ QString appendShortcutExtension(const QString &shortcut)
|
||||||
QString getVersionFromExecutable(const QString &path)
|
QString getVersionFromExecutable(const QString &path)
|
||||||
{
|
{
|
||||||
// check if file exists
|
// check if file exists
|
||||||
if (!QFile::exists(path)) return "";
|
if (!QFile::exists(path))
|
||||||
|
{
|
||||||
|
nlwarning("Unable to find %s", Q2C(path));
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef Q_OS_WIN32
|
#ifndef Q_OS_WIN32
|
||||||
// fix executable permissions under UNIX
|
// fix executable permissions under UNIX
|
||||||
QFile::setPermissions(path, QFile::permissions(path) | QFile::ExeGroup | QFile::ExeUser | QFile::ExeOther);
|
if (!QFile::setPermissions(path, QFile::permissions(path) | QFile::ExeGroup | QFile::ExeUser | QFile::ExeOther))
|
||||||
|
{
|
||||||
|
nlwarning("Unable to set executable permissions to %s", Q2C(path));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// launch executable with --version argument
|
// launch executable with --version argument
|
||||||
QProcess process;
|
QProcess process;
|
||||||
process.setProcessChannelMode(QProcess::MergedChannels);
|
process.setProcessChannelMode(QProcess::MergedChannels);
|
||||||
process.start(path, QStringList() << "--version", QIODevice::ReadWrite);
|
process.start(path, QStringList() << "--version", QIODevice::ReadOnly);
|
||||||
|
|
||||||
if (!process.waitForStarted()) return "";
|
if (!process.waitForStarted())
|
||||||
|
{
|
||||||
|
nlwarning("Unable to start %s", Q2C(path));
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
|
|
||||||
// read all output
|
// read all output
|
||||||
while (process.waitForReadyRead(1000)) data.append(process.readAll());
|
while (process.waitForReadyRead(1000)) data.append(process.readAll());
|
||||||
|
|
||||||
if (!data.isEmpty())
|
if (data.isEmpty())
|
||||||
|
{
|
||||||
|
nlwarning("%s --version didn't return any data", Q2C(path));
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
QString versionString = QString::fromUtf8(data);
|
QString versionString = QString::fromUtf8(data);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue