mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +08:00
refs #294 fixed X-Plane paths on Mac
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "traffic.h"
|
#include "traffic.h"
|
||||||
#include "XPMPMultiplayer.h"
|
#include "XPMPMultiplayer.h"
|
||||||
|
#include "XPMPMultiplayerCSL.h"
|
||||||
#include <XPLM/XPLMProcessing.h>
|
#include <XPLM/XPLMProcessing.h>
|
||||||
#include <XPLM/XPLMUtilities.h>
|
#include <XPLM/XPLMUtilities.h>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
@@ -29,6 +30,22 @@ namespace XBus
|
|||||||
surfaces.lights.timeOffset = static_cast<quint16>(qrand() % 0xffff);
|
surfaces.lights.timeOffset = static_cast<quint16>(qrand() % 0xffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString g_xplanePath;
|
||||||
|
QString g_sep;
|
||||||
|
|
||||||
|
void initXPlanePath()
|
||||||
|
{
|
||||||
|
char xplanePath[512];
|
||||||
|
XPLMGetSystemPath(xplanePath);
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
HFS2PosixPath(xplanePath, xplanePath, sizeof(xplanePath));
|
||||||
|
g_sep = "/";
|
||||||
|
#else
|
||||||
|
g_sep = XPLMGetDirectorySeparator();
|
||||||
|
#endif
|
||||||
|
g_xplanePath = xplanePath;
|
||||||
|
}
|
||||||
|
|
||||||
CTraffic::CTraffic(QObject *parent) : QObject(parent)
|
CTraffic::CTraffic(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -42,10 +59,8 @@ namespace XBus
|
|||||||
|
|
||||||
void CTraffic::initLegacyData()
|
void CTraffic::initLegacyData()
|
||||||
{
|
{
|
||||||
char xplanePath[512];
|
initXPlanePath();
|
||||||
XPLMGetSystemPath(xplanePath);
|
auto dir = g_xplanePath + "Resources" + g_sep + "plugins" + g_sep + "xbus" + g_sep + "LegacyData" + g_sep;
|
||||||
auto dir = QString(xplanePath) + "Resources" + XPLMGetDirectorySeparator() + "plugins" + XPLMGetDirectorySeparator()
|
|
||||||
+ "xbus" + XPLMGetDirectorySeparator() + "LegacyData" + XPLMGetDirectorySeparator();
|
|
||||||
|
|
||||||
auto err = XPMPMultiplayerInitLegacyData(qPrintable(dir + "CSL"), qPrintable(dir + "related.txt"),
|
auto err = XPMPMultiplayerInitLegacyData(qPrintable(dir + "CSL"), qPrintable(dir + "related.txt"),
|
||||||
qPrintable(dir + "lights.png"), qPrintable(dir + "Doc8643.txt"), "C172", preferences, preferences);
|
qPrintable(dir + "lights.png"), qPrintable(dir + "Doc8643.txt"), "C172", preferences, preferences);
|
||||||
@@ -103,10 +118,8 @@ namespace XBus
|
|||||||
|
|
||||||
bool CTraffic::loadPlanesPackage(const QString &path)
|
bool CTraffic::loadPlanesPackage(const QString &path)
|
||||||
{
|
{
|
||||||
char xplanePath[512];
|
initXPlanePath();
|
||||||
XPLMGetSystemPath(xplanePath);
|
auto dir = g_xplanePath + "Resources" + g_sep + "plugins" + g_sep + "xbus" + g_sep + "LegacyData" + g_sep;
|
||||||
auto dir = QString(xplanePath) + "Resources" + XPLMGetDirectorySeparator() + "plugins" + XPLMGetDirectorySeparator()
|
|
||||||
+ "xbus" + XPLMGetDirectorySeparator() + "LegacyData" + XPLMGetDirectorySeparator();
|
|
||||||
|
|
||||||
auto err = XPMPLoadCSLPackage(qPrintable(path), qPrintable(dir + "related.txt"), qPrintable(dir + "Doc8643.txt"));
|
auto err = XPMPLoadCSLPackage(qPrintable(path), qPrintable(dir + "related.txt"), qPrintable(dir + "Doc8643.txt"));
|
||||||
if (*err) { return false; }
|
if (*err) { return false; }
|
||||||
|
|||||||
Reference in New Issue
Block a user