[chronojump] Fixed Chronojump check running two times on Linux
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Fixed Chronojump check running two times on Linux
- Date: Mon, 12 May 2014 15:28:06 +0000 (UTC)
commit 71c63bcf4fb58f7d311e194190d24416cfe6f642
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon May 12 17:27:29 2014 +0200
Fixed Chronojump check running two times on Linux
src/chronojump.cs | 28 +++++++++++++++++++---------
1 files changed, 19 insertions(+), 9 deletions(-)
---
diff --git a/src/chronojump.cs b/src/chronojump.cs
index f4847a5..bc04d34 100644
--- a/src/chronojump.cs
+++ b/src/chronojump.cs
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Copyright (C) 2004-2012 Xavier de Blas <xaviblas gmail com>
+ * Copyright (C) 2004-2014 Xavier de Blas <xaviblas gmail com>
*/
@@ -740,6 +740,15 @@ Console.WriteLine("--6--");
return false;
}
+ private bool chronojumpIsExecutingNTimesComparePids(string pidName, string pid) {
+ Process [] pids = Process.GetProcessesByName(pidName);
+
+ foreach (Process myPid in pids)
+ if (myPid.Id == Convert.ToInt32(pid))
+ return true;
+ return false;
+ }
+
private bool chronojumpIsExecutingNTimes() {
try {
StreamReader reader = File.OpenText(runningFileName);
@@ -749,16 +758,17 @@ Console.WriteLine("--6--");
//delete the '\n' that ReaderToEnd() has put
pid = pid.TrimEnd(new char[1] {'\n'});
- string searchName = "mono";
if(UtilAll.IsWindows())
- searchName = "Chronojump";
-
- Process [] pids = Process.GetProcessesByName(searchName);
-
- foreach (Process myPid in pids)
- if (myPid.Id == Convert.ToInt32(pid))
+ return chronojumpIsExecutingNTimesComparePids("Chronojump", pid);
+ else {
+ //in linux process was names mono, but now is named mono-sgen
+ bool found = chronojumpIsExecutingNTimesComparePids("mono", pid);
+ if(found)
return true;
- return false;
+ else
+ return chronojumpIsExecutingNTimesComparePids("mono-sgen", pid);
+ }
+
} catch {
/*
if we a chronojump older that 0.8.9.8 has crashed, and now we install 0.8.9.8
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]