|
|
@ -32,11 +32,52 @@ QString CServer::getDirectory() const
|
|
|
|
return CConfigFile::getInstance()->getInstallationDirectory() + "/" + id;
|
|
|
|
return CConfigFile::getInstance()->getInstallationDirectory() + "/" + id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString CServer::getClientFullPath() const
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (clientFilename.isEmpty()) return "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return getDirectory() + "/" + clientFilename;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString CServer::getConfigurationFullPath() const
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (configurationFilename.isEmpty()) return "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return getDirectory() + "/" + configurationFilename;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QString CProfile::getDirectory() const
|
|
|
|
QString CProfile::getDirectory() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return CConfigFile::getInstance()->getProfileDirectory() + "/" + id;
|
|
|
|
return CConfigFile::getInstance()->getProfileDirectory() + "/" + id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString CProfile::getClientFullPath() const
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!executable.isEmpty()) return executable;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const CServer &s = CConfigFile::getInstance()->getServer(server);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return s.getClientFullPath();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString CProfile::getClientDesktopLinkFullPath() const
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
#ifdef Q_OS_WIN32
|
|
|
|
|
|
|
|
return CConfigFile::getInstance()->getDesktopDirectory() + "/" + name + ".lnk";
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
return "";
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString CProfile::getClientMenuLinkFullPath() const
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
#ifdef Q_OS_WIN32
|
|
|
|
|
|
|
|
return CConfigFile::getInstance()->getMenuDirectory() + "/" + name + ".lnk";
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
return "";
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CConfigFile *CConfigFile::s_instance = NULL;
|
|
|
|
CConfigFile *CConfigFile::s_instance = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
CConfigFile::CConfigFile(QObject *parent):QObject(parent), m_defaultServerIndex(0), m_defaultProfileIndex(0), m_use64BitsClient(false), m_shouldUninstallOldClient(true)
|
|
|
|
CConfigFile::CConfigFile(QObject *parent):QObject(parent), m_defaultServerIndex(0), m_defaultProfileIndex(0), m_use64BitsClient(false), m_shouldUninstallOldClient(true)
|
|
|
@ -323,6 +364,16 @@ void CConfigFile::removeProfile(const QString &id)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString CConfigFile::getDesktopDirectory() const
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString CConfigFile::getMenuDirectory() const
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation) + "/" + QApplication::applicationName();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CConfigFile::has64bitsOS()
|
|
|
|
bool CConfigFile::has64bitsOS()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return QSysInfo::currentCpuArchitecture() == "x86_64";
|
|
|
|
return QSysInfo::currentCpuArchitecture() == "x86_64";
|
|
|
@ -380,9 +431,28 @@ QString CConfigFile::getProfileDirectory() const
|
|
|
|
|
|
|
|
|
|
|
|
QString CConfigFile::getSrcProfileDirectory() const
|
|
|
|
QString CConfigFile::getSrcProfileDirectory() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (QFile::exists(getSrcServerDirectory() + "/client.cfg")) return getSrcServerDirectory();
|
|
|
|
QString filename = "client.cfg";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QStringList paths;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// same path as client
|
|
|
|
|
|
|
|
paths << getSrcServerDirectory();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// profile path root
|
|
|
|
|
|
|
|
paths << getProfileDirectory();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC)
|
|
|
|
|
|
|
|
// specific path under Linux
|
|
|
|
|
|
|
|
paths << QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/.ryzom";
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// search config file in these locations
|
|
|
|
|
|
|
|
foreach(const QString &path, paths)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (QFile::exists(path + "/" + filename)) return path;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return qFromUtf8(NLMISC::CPath::getApplicationDirectory("Ryzom"));
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CConfigFile::use64BitsClient() const
|
|
|
|
bool CConfigFile::use64BitsClient() const
|
|
|
@ -608,10 +678,12 @@ bool CConfigFile::foundTemporaryFiles(const QString &directory) const
|
|
|
|
|
|
|
|
|
|
|
|
bool CConfigFile::shouldCreateDesktopShortcut() const
|
|
|
|
bool CConfigFile::shouldCreateDesktopShortcut() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#ifdef Q_OS_WIN32
|
|
|
|
|
|
|
|
const CProfile &profile = getProfile();
|
|
|
|
const CProfile &profile = getProfile();
|
|
|
|
|
|
|
|
|
|
|
|
return profile.desktopShortcut && !NLMISC::CFile::isExists(qToUtf8(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation) + "/Ryzom.lnk"));
|
|
|
|
if (!profile.desktopShortcut) return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef Q_OS_WIN32
|
|
|
|
|
|
|
|
return !NLMISC::CFile::isExists(qToUtf8(profile.getClientDesktopLinkFullPath()));
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -619,42 +691,29 @@ bool CConfigFile::shouldCreateDesktopShortcut() const
|
|
|
|
|
|
|
|
|
|
|
|
bool CConfigFile::shouldCreateMenuShortcut() const
|
|
|
|
bool CConfigFile::shouldCreateMenuShortcut() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#ifdef Q_OS_WIN32
|
|
|
|
|
|
|
|
const CProfile &profile = getProfile();
|
|
|
|
const CProfile &profile = getProfile();
|
|
|
|
|
|
|
|
|
|
|
|
return profile.menuShortcut && !NLMISC::CFile::isExists(qToUtf8(QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation) + "/Ryzom/Ryzom.lnk"));
|
|
|
|
if (!profile.menuShortcut) return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef Q_OS_WIN32
|
|
|
|
|
|
|
|
return !NLMISC::CFile::isExists(qToUtf8(profile.getClientMenuLinkFullPath()));
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QString CConfigFile::getProfileClientFullPath(int profileIndex) const
|
|
|
|
QString CConfigFile::getInstallerFullPath() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const CProfile &profile = getProfile(profileIndex);
|
|
|
|
return QApplication::applicationFilePath();
|
|
|
|
|
|
|
|
|
|
|
|
QString path = profile.executable;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!path.isEmpty()) return path;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return getServerClientFullPath(profile.server);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QString CConfigFile::getServerClientFullPath(const QString &serverId) const
|
|
|
|
QString CConfigFile::getInstallerMenuLinkFullPath() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const CServer &server = getServer(serverId);
|
|
|
|
#ifdef Q_OS_WIN32
|
|
|
|
|
|
|
|
return QString("%1/%2/%2 Installer.lnk").arg(QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation)).arg(QApplication::applicationName());
|
|
|
|
if (server.clientFilename.isEmpty()) return "";
|
|
|
|
#else
|
|
|
|
|
|
|
|
return "";
|
|
|
|
return server.getDirectory() + "/" + server.clientFilename;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString CConfigFile::getServerConfigurationFullPath(const QString &serverId) const
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
const CServer &server = getServer(serverId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (server.configurationFilename.isEmpty()) return "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return server.getDirectory() + "/" + server.configurationFilename;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QString CConfigFile::getSrcServerClientBNPFullPath() const
|
|
|
|
QString CConfigFile::getSrcServerClientBNPFullPath() const
|
|
|
|