Skip to content

Commit

Permalink
change command line switch to --run-diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed Sep 27, 2012
1 parent f99b7f5 commit 2bd634e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package/win32/cmake/modules/NSIS.template.in
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ Section "-Core installation"
;
CreateShortCut "$INSTDIR\bin\Run Diagnostics.lnk" \
"$WINDIR\system32\cmd.exe" \
"/K $\"$INSTDIR\bin\rstudio.exe$\" --verify-installation" \
"/K $\"$INSTDIR\bin\rstudio.exe$\" --run-diagnostics" \
"$WINDIR\system32\cmd.exe" 0 \
SW_SHOWNORMAL

Expand Down
6 changes: 3 additions & 3 deletions src/cpp/desktop/DesktopMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ int main(int argc, char* argv[])
if (pApp->arguments().size() > 1)
{
QString arg = pApp->arguments().last();
if (arg != QString::fromAscii(kVerifyInstallationOption))
if (arg != QString::fromAscii(kRunDiagnosticsOption))
filename = verifyAndNormalizeFilename(arg);
}
}
Expand All @@ -249,8 +249,8 @@ int main(int argc, char* argv[])
// init options from command line
desktop::options().initFromCommandLine(pApp->arguments());

// reset log if we are in verify-installation mode
if (desktop::options().verifyInstallation())
// reset log if we are in run-diagnostics mode
if (desktop::options().runDiagnostics())
{
desktop::reattachConsoleIfNecessary();
initializeStderrLog("rdesktop", core::system::kLogLevelWarning);
Expand Down
4 changes: 2 additions & 2 deletions src/cpp/desktop/DesktopOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ void Options::initFromCommandLine(const QStringList& arguments)
for (int i=1; i<arguments.size(); i++)
{
QString arg = arguments.at(i);
if (arg == QString::fromAscii(kVerifyInstallationOption))
verifyInstallation_ = true;
if (arg == QString::fromAscii(kRunDiagnosticsOption))
runDiagnostics_ = true;
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/cpp/desktop/DesktopOptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include <core/FilePath.hpp>

#define kVerifyInstallationOption "--verify-installation"
#define kRunDiagnosticsOption "--run-diagnostics"

#if defined(__APPLE__)
#define FORMAT QSettings::NativeFormat
Expand Down Expand Up @@ -83,13 +83,13 @@ class Options : boost::noncopyable

bool webkitDevTools();

bool verifyInstallation() { return verifyInstallation_; }
bool runDiagnostics() { return runDiagnostics_; }

private:
Options() : settings_(FORMAT, QSettings::UserScope,
QString::fromAscii("RStudio"),
QString::fromAscii("desktop")),
verifyInstallation_(false)
runDiagnostics_(false)
{
}
friend Options& options();
Expand All @@ -99,7 +99,7 @@ class Options : boost::noncopyable
mutable core::FilePath executablePath_;
mutable core::FilePath supportingFilePath_;
mutable QString portNumber_;
bool verifyInstallation_;
bool runDiagnostics_;
};

} // namespace desktop
Expand Down
20 changes: 10 additions & 10 deletions src/cpp/desktop/DesktopSessionLauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "DesktopSlotBinders.hpp"
#include "DesktopGwtCallback.hpp"

#define VERIFY_INSTALLATION_LOG(message) if (desktop::options().verifyInstallation()) \
#define RUN_DIAGNOSTICS_LOG(message) if (desktop::options().runDiagnostics()) \
std::cout << (message) << std::endl;

using namespace core;
Expand All @@ -44,7 +44,7 @@ void launchProcess(std::string absPath,
QProcess** ppProc)
{
QProcess* pProcess = new QProcess();
if (options().verifyInstallation())
if (options().runDiagnostics())
pProcess->setProcessChannelMode(QProcess::ForwardedChannels);
else
pProcess->setProcessChannelMode(QProcess::SeparateChannels);
Expand All @@ -70,7 +70,7 @@ void logEnvVar(const std::string& name)
{
std::string value = core::system::getenv(name);
if (!value.empty())
VERIFY_INSTALLATION_LOG(" " + name + "=" + value);
RUN_DIAGNOSTICS_LOG(" " + name + "=" + value);
}

} // anonymous namespace
Expand All @@ -88,7 +88,7 @@ Error SessionLauncher::launchFirstSession(const QString& filename,
QUrl url;
buildLaunchContext(&host, &port, &argList, &url);

VERIFY_INSTALLATION_LOG("\nAttempting to launch R session...");
RUN_DIAGNOSTICS_LOG("\nAttempting to launch R session...");
logEnvVar("RSTUDIO_WHICH_R");
logEnvVar("R_HOME");
logEnvVar("R_DOC_DIR");
Expand All @@ -107,7 +107,7 @@ Error SessionLauncher::launchFirstSession(const QString& filename,
if (error)
return error;

VERIFY_INSTALLATION_LOG("\nR session launched, "
RUN_DIAGNOSTICS_LOG("\nR session launched, "
"attempting to connect on port "
+ port.toStdString() +
"...");
Expand All @@ -131,7 +131,7 @@ Error SessionLauncher::launchFirstSession(const QString& filename,
if (error)
return error;

VERIFY_INSTALLATION_LOG("\nConnected to R session, attempting to initialize...\n");
RUN_DIAGNOSTICS_LOG("\nConnected to R session, attempting to initialize...\n");

// one-time workbench intiailized hook for startup file association
if (!filename.isNull() && !filename.isEmpty())
Expand All @@ -157,8 +157,8 @@ Error SessionLauncher::launchFirstSession(const QString& filename,
this, SLOT(onRSessionExited(int,QProcess::ExitStatus)));


// show the window (but don't if we are doing a --verify-installation)
if (!options().verifyInstallation())
// show the window (but don't if we are doing a --run-diagnostics)
if (!options().runDiagnostics())
{
pMainWindow_->show();
pAppLaunch->activateWindow();
Expand All @@ -183,7 +183,7 @@ void SessionLauncher::closeAllSatillites()
void SessionLauncher::onRSessionExited(int, QProcess::ExitStatus)
{
// if this is a verify-installation session then just quit
if (options().verifyInstallation())
if (options().runDiagnostics())
{
pMainWindow_->quit();
return;
Expand Down Expand Up @@ -400,7 +400,7 @@ void SessionLauncher::buildLaunchContext(QString* pHost,

*pArgList << QString::fromAscii("--www-port") << *pPort;

if (options().verifyInstallation())
if (options().runDiagnostics())
*pArgList << QString::fromAscii("--verify-installation") <<
QString::fromAscii("1");
}
Expand Down

0 comments on commit 2bd634e

Please sign in to comment.