Mercurial > hg > easyhg
diff hgrunner.cpp @ 172:b6dd1ee0e486
* Fix failure to recognise local uncommitted changes when an untracked file was selected
* Win32: Look in installed location (currently just the location of the present .exe) for executables as well as in path
* Win32: Search for easyhg extension in same way as executables
* Win32: Set installed location to path when running hg commands (for dependent DLLs)
author | Chris Cannam |
---|---|
date | Wed, 15 Dec 2010 22:07:31 +0000 |
parents | 0dfd6567ec0c |
children | 6def8bf3be44 |
line wrap: on
line diff
--- a/hgrunner.cpp Tue Dec 14 21:16:52 2010 +0000 +++ b/hgrunner.cpp Wed Dec 15 22:07:31 2010 +0000 @@ -39,7 +39,9 @@ #include <fcntl.h> #endif -HgRunner::HgRunner(QWidget * parent): QProgressBar(parent) +HgRunner::HgRunner(QString myDirPath, QWidget * parent) : + QProgressBar(parent), + m_myDirPath(myDirPath) { m_proc = 0; @@ -47,7 +49,7 @@ setVisible(false); m_isRunning = false; - unbundleExtension(); + findExtension(); } HgRunner::~HgRunner() @@ -59,6 +61,16 @@ } } +void HgRunner::findExtension() +{ + m_extensionPath = findInPath("easyhg.py", m_myDirPath, false); + if (m_extensionPath == "easyhg.py") { + if (!unbundleExtension()) { + m_extensionPath = ""; + } + } +} + bool HgRunner::unbundleExtension() { QString bundled = ":easyhg.py"; @@ -108,7 +120,7 @@ QSettings settings; QString hg = settings.value("hgbinary", "").toString(); if (hg == "") { - hg = findExecutable("hg"); + hg = findInPath("hg", m_myDirPath, true); } if (hg != "hg") { settings.setValue("hgbinary", hg); @@ -342,7 +354,14 @@ m_proc = new QProcess; - QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); + QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); + +#ifdef Q_OS_WIN32 + if (m_myDirPath != "") { + env.insert("PATH", m_myDirPath + ";" + env.value("PATH")); + } +#endif + env.insert("LANG", "en_US.utf8"); env.insert("LC_ALL", "en_US.utf8"); env.insert("HGPLAIN", "1");