mirror of
https://github.com/MultiMC/MultiMC5.git
synced 2024-12-27 21:15:19 +00:00
Try to be cross-platform
This commit is contained in:
parent
6f6d912d07
commit
c0e58fbfb2
@ -1,5 +1,7 @@
|
||||
#include "BaseProfiler.h"
|
||||
|
||||
#include <QProcess>
|
||||
|
||||
BaseProfiler::BaseProfiler(OneSixInstance *instance, QObject *parent)
|
||||
: QObject(parent), m_instance(instance)
|
||||
{
|
||||
@ -14,6 +16,15 @@ void BaseProfiler::beginProfiling(MinecraftProcess *process)
|
||||
beginProfilingImpl(process);
|
||||
}
|
||||
|
||||
qint64 BaseProfiler::pid(QProcess *process)
|
||||
{
|
||||
#ifdef Q_OS_UNIX
|
||||
return process->pid();
|
||||
#else
|
||||
return (qint64)process->pid();
|
||||
#endif
|
||||
}
|
||||
|
||||
BaseProfilerFactory::~BaseProfilerFactory()
|
||||
{
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
class OneSixInstance;
|
||||
class SettingsObject;
|
||||
class MinecraftProcess;
|
||||
class QProcess;
|
||||
|
||||
class BaseProfiler : public QObject
|
||||
{
|
||||
@ -22,6 +23,8 @@ protected:
|
||||
|
||||
virtual void beginProfilingImpl(MinecraftProcess *process) = 0;
|
||||
|
||||
qint64 pid(QProcess *process);
|
||||
|
||||
signals:
|
||||
void readyToLaunch(const QString &message);
|
||||
};
|
||||
|
@ -16,7 +16,7 @@ void JProfiler::beginProfilingImpl(MinecraftProcess *process)
|
||||
{
|
||||
int port = MMC->settings()->get("JProfilerPort").toInt();
|
||||
QProcess *profiler = new QProcess(this);
|
||||
profiler->setArguments(QStringList() << "-d" << QString::number(process->pid()) << "--gui"
|
||||
profiler->setArguments(QStringList() << "-d" << QString::number(pid(process)) << "--gui"
|
||||
<< "-p" << QString::number(port));
|
||||
profiler->setProgram(QDir(MMC->settings()->get("JProfilerPath").toString())
|
||||
.absoluteFilePath("bin/jpenable"));
|
||||
|
Loading…
Reference in New Issue
Block a user