Permalink
Browse files

Allow easier setting of custom profile path using --profile-path argu…

…ment
  • Loading branch information...
1 parent a2b4a26 commit b5b516341811e232c45325cb7b3265f4e2ca5557 @marek-safar marek-safar committed Jun 25, 2012
Showing with 19 additions and 9 deletions.
  1. +10 −5 gui-compare/InfoManager.cs
  2. +7 −2 gui-compare/Main.cs
  3. +2 −2 gui-compare/MainWindow.cs
@@ -797,12 +797,17 @@ public void PopulateRecent ()
//
// Constructor
//
- public InfoManager (MainWindow main)
+ public InfoManager (MainWindow main, string profilePath)
{
this.main = main;
- string corlibdir = System.IO.Path.GetDirectoryName (typeof (int).Assembly.Location);
- monodir = System.IO.Path.GetFullPath (System.IO.Path.Combine (corlibdir, ".."));
+ if (profilePath == null) {
+ string corlibdir = System.IO.Path.GetDirectoryName (typeof (int).Assembly.Location);
+ monodir = System.IO.Path.GetFullPath (System.IO.Path.Combine (corlibdir, ".."));
+ } else {
+ monodir = profilePath;
+ }
+
moondir = System.IO.Path.Combine (monodir, @"../moonlight/plugin");
// Work around limitation in Stetic, there is no way
@@ -860,9 +865,9 @@ public InfoManager (MainWindow main)
Populate (sub, "Silverlight 4.0", GetVersionPath ("2.1", "net_2_1"), "SL4", api_sl4);
}
- static string GetVersionPath (string version, string profile)
+ string GetVersionPath (string version, string profile)
{
- if (string.IsNullOrEmpty (Environment.GetEnvironmentVariable ("MONO_PATH")))
+ if (!monodir.Contains (Path.Combine ("mcs", "class", "lib")))
return version;
// Developer's version pointing to /mcs/class/lib/<profile>/
View
@@ -36,7 +36,7 @@ public static void Main (string[] args)
{
Application.Init ();
- try {
+ try {
InfoManager.Init ();
} catch (Exception e) {
Dialog d = new Dialog ("Error", null, DialogFlags.Modal, new object [] {
@@ -46,7 +46,12 @@ public static void Main (string[] args)
d.Run ();
return;
}
- MainWindow win = new MainWindow ();
+
+ string profile_path = null;
+ if (args.Length != 0 && args[0].StartsWith ("--profile-path="))
+ profile_path = args[0].Substring (15);
+
+ MainWindow win = new MainWindow (profile_path);
win.Show ();
if (args.Length == 2 && File.Exists (args [0]) && File.Exists (args [1])){
win.ComparePaths (args [0], args [1]);
@@ -104,7 +104,7 @@ static MainWindow ()
Gdk.Color.Parse ("#000000", ref black);
}
- public MainWindow () : base(Gtk.WindowType.Toplevel)
+ public MainWindow (string profilePath) : base(Gtk.WindowType.Toplevel)
{
Build ();
notebook1.Page = 1;
@@ -114,7 +114,7 @@ public MainWindow () : base(Gtk.WindowType.Toplevel)
//
// Configure the GUI
//
- info_manager = new InfoManager (this);
+ info_manager = new InfoManager (this, profilePath);
treeStore = new Gtk.TreeStore (typeof (string), // Name
typeof (Gdk.Pixbuf), typeof (Gdk.Pixbuf), // TypeIcon, StatusIcon

0 comments on commit b5b5163

Please sign in to comment.