[niftyplugins] r83 committed - - Added new code to do a fallback on checking the path to make sure th...

0 views
Skip to first unread message

codesite...@google.com

unread,
Nov 29, 2009, 3:55:28 PM11/29/09
to niftyplug...@googlegroups.com
Revision: 83
Author: jim.tilander
Date: Sun Nov 29 12:54:30 2009
Log: - Added new code to do a fallback on checking the path to make sure
that the executables are there (perforce).
http://code.google.com/p/niftyplugins/source/detail?r=83

Added:
/trunk/Shared/Help.cs
Modified:
/trunk/Build/Experimental_NiftyPerforce.msi
/trunk/Build/Experimental_NiftySolution.msi
/trunk/NiftyPerforce/P4Operations.cs
/trunk/Shared/AuroraCore.csproj

=======================================
--- /dev/null
+++ /trunk/Shared/Help.cs Sun Nov 29 12:54:30 2009
@@ -0,0 +1,23 @@
+using System;
+using System.IO;
+
+namespace Aurora
+{
+ public static class Help
+ {
+ public static string FindFileInPath(string filename)
+ {
+ string pathenv = Environment.GetEnvironmentVariable("PATH");
+ string[] items = pathenv.Split(';');
+
+ foreach(string item in items)
+ {
+ string candidate = Path.Combine(item, filename);
+ if(System.IO.File.Exists(candidate))
+ return candidate;
+ }
+
+ return null;
+ }
+ }
+}
=======================================
--- /trunk/Build/Experimental_NiftyPerforce.msi Tue Jul 7 22:51:01 2009
+++ /trunk/Build/Experimental_NiftyPerforce.msi Sun Nov 29 12:54:30 2009
Binary file, no diff available.
=======================================
--- /trunk/Build/Experimental_NiftySolution.msi Tue Jul 7 22:51:01 2009
+++ /trunk/Build/Experimental_NiftySolution.msi Sun Nov 29 12:54:30 2009
Binary file, no diff available.
=======================================
--- /trunk/NiftyPerforce/P4Operations.cs Wed Oct 28 23:51:50 2009
+++ /trunk/NiftyPerforce/P4Operations.cs Sun Nov 29 12:54:30 2009
@@ -358,48 +358,69 @@
g_p4wininstalled = false;
g_p4vinstalled = false;
g_p4customdiff = false;
-
+ string p4diff = null;
string installRoot =
GetRegistryValue("SOFTWARE\\Perforce\\Environment", "P4INSTROOT", true); ;

// TODO: We might want to check for older versions of perforce here as
well...
- if(null == installRoot)
- {
- Log.Error("Could not find any peforce installation in the
registry!!!");
- return;
- }
- Log.Info("Found perforce installation at {0}", installRoot);
-
-
if(System.IO.File.Exists(System.IO.Path.Combine(installRoot, "p4.exe")))
- {
- g_p4installed = true;
- Log.Info("Found p4.exe");
- }
-
if(System.IO.File.Exists(System.IO.Path.Combine(installRoot, "p4win.exe")))
- {
- g_p4wininstalled = true;
- Log.Info("Found p4win.exe");
- }
-
if(System.IO.File.Exists(System.IO.Path.Combine(installRoot, "p4v.exe")))
- {
- g_p4vinstalled = true;
- Log.Info("Found p4v.exe");
- }
-
- string p4diff = System.Environment.GetEnvironmentVariable("P4DIFF");
- if(null != p4diff)
- {
- g_p4customdiff = true;
- }
-
- p4diff = GetRegistryValue("SOFTWARE\\Perforce\\Environment", "P4DIFF",
true);
- if(null != p4diff && p4diff.Length > 0)
- {
- g_p4customdiff = true;
- }
- p4diff = GetRegistryValue("SOFTWARE\\Perforce\\Environment", "P4DIFF",
false);
- if(null != p4diff && p4diff.Length > 0)
- {
- g_p4customdiff = true;
+ if(null != installRoot)
+ {
+ Log.Info("Found perforce installation at {0}", installRoot);
+
+
if(System.IO.File.Exists(System.IO.Path.Combine(installRoot, "p4.exe")))
+ {
+ g_p4installed = true;
+ Log.Info("Found p4.exe");
+ }
+
if(System.IO.File.Exists(System.IO.Path.Combine(installRoot, "p4win.exe")))
+ {
+ g_p4wininstalled = true;
+ Log.Info("Found p4win.exe");
+ }
+
if(System.IO.File.Exists(System.IO.Path.Combine(installRoot, "p4v.exe")))
+ {
+ g_p4vinstalled = true;
+ Log.Info("Found p4v.exe");
+ }
+
+ p4diff =
GetRegistryValue("SOFTWARE\\Perforce\\Environment", "P4DIFF", true);
+ if(null != p4diff && p4diff.Length > 0)
+ {
+ g_p4customdiff = true;
+ }
+ p4diff =
GetRegistryValue("SOFTWARE\\Perforce\\Environment", "P4DIFF", false);
+ if(null != p4diff && p4diff.Length > 0)
+ {
+ g_p4customdiff = true;
+ }
+ }
+ else
+ {
+ // Let's try to find the executables through the path variable
instead.
+ if(null != Help.FindFileInPath("p4.exe"))
+ {
+ g_p4installed = true;
+ Log.Info("Found p4 in path");
+ }
+
+ if(null != Help.FindFileInPath("p4win.exe"))
+ {
+ g_p4wininstalled = true;
+ Log.Info("Found p4win in path");
+ }
+
+ if(null != Help.FindFileInPath("p4v.exe"))
+ {
+ g_p4vinstalled = true;
+ Log.Info("Found p4v in path");
+ }
+
+ Log.Warning("Could not find any peforce installation in the
registry!!!");
+
+ p4diff = System.Environment.GetEnvironmentVariable("P4DIFF");
+ if(null != p4diff)
+ {
+ g_p4customdiff = true;
+ }
}
}

=======================================
--- /trunk/Shared/AuroraCore.csproj Thu Apr 30 01:04:22 2009
+++ /trunk/Shared/AuroraCore.csproj Sun Nov 29 12:54:30 2009
@@ -44,6 +44,7 @@
<Compile Include="DebugLogHandler.cs" />
<Compile Include="Feature.cs" />
<Compile Include="File.cs" />
+ <Compile Include="Help.cs" />
<Compile Include="Log.cs" />
<Compile Include="Plugin.cs" />
<Compile Include="Process.cs" />
Reply all
Reply to author
Forward
0 new messages