~nmarshall23/do-plugins/spellcheck-plugin

« back to all changes in this revision

Viewing changes to debian/patches/01_firefox_iceweasel_rename.dpatch

  • Committer: Nicholas Marshall
  • Date: 2009-08-15 15:57:33 UTC
  • Revision ID: nmarshall23@gmail.com-20090815155733-r0s3dnbx7je4zbpp
Building debs in a separate branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh /usr/share/dpatch/dpatch-run
2
 
## firefox_iceweasel_rename.dpatch by  <ct@piglets.com>
3
 
##
4
 
## DP: The OpenSearch plugin searches for firefox search plugins,
5
 
## DP: but of course, on a Debian system this is to be found under
6
 
## DP: iceweasel, not firefox.
7
 
## DP:
8
 
## DP: This patch also makes the Firefox bookmarks plugin index
9
 
## DP: Iceweasel bookmarks.
10
 
 
11
 
@DPATCH@
12
 
diff -urNad gnome-do-plugins-0.8.2+dfsg~/Firefox/src/PlacesItemSource.cs gnome-do-plugins-0.8.2+dfsg/Firefox/src/PlacesItemSource.cs
13
 
--- gnome-do-plugins-0.8.2+dfsg~/Firefox/src/PlacesItemSource.cs        2009-06-23 11:00:43.000000000 +1000
14
 
+++ gnome-do-plugins-0.8.2+dfsg/Firefox/src/PlacesItemSource.cs 2009-06-28 20:52:39.596179763 +1000
15
 
@@ -160,8 +160,13 @@
16
 
                        profile = null;
17
 
                        home = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
18
 
                        
19
 
-                       path = Path.Combine (home, ".mozilla/firefox/profiles.ini");
20
 
-                       using (StreamReader r = File.OpenText (path)) {
21
 
+                       path = Path.Combine (home, ".mozilla");
22
 
+                       if (Directory.Exists (Path.Combine (path, "firefox"))) {
23
 
+                               path = Path.Combine (path, "firefox");
24
 
+                       } else if (Directory.Exists (Path.Combine (path, "iceweasel"))) {
25
 
+                               path = Path.Combine (path, "iceweasel");
26
 
+                       }
27
 
+                       using (StreamReader r = File.OpenText (Path.Combine (path, "profiles.ini"))) {
28
 
                                while ((line = r.ReadLine ()) != null) {
29
 
                                        if (line.StartsWith (BeginDefaultProfile)) {
30
 
                                                break;
31
 
@@ -172,7 +177,7 @@
32
 
                                        }
33
 
                                }
34
 
                        }
35
 
-                       return new [] {home, ".mozilla", "firefox", profile}.Aggregate (Path.Combine); 
36
 
+                       return Path.Combine (path, profile); 
37
 
                }
38
 
 
39
 
 
40
 
diff -urNad gnome-do-plugins-0.8.2+dfsg~/OpenSearch/src/FirefoxOpenSearchDirectoryProvider.cs gnome-do-plugins-0.8.2+dfsg/OpenSearch/src/FirefoxOpenSearchDirectoryProvider.cs
41
 
--- gnome-do-plugins-0.8.2+dfsg~/OpenSearch/src/FirefoxOpenSearchDirectoryProvider.cs   2009-06-23 11:00:43.000000000 +1000
42
 
+++ gnome-do-plugins-0.8.2+dfsg/OpenSearch/src/FirefoxOpenSearchDirectoryProvider.cs    2009-06-28 20:38:51.032212068 +1000
43
 
@@ -37,6 +37,9 @@
44
 
        /// </summary>
45
 
        public class FirefoxOpenSearchDirectoryProvider
46
 
        {
47
 
+               private static string firefoxPath = "/usr/bin/firefox";
48
 
+               private static string iceweaselPath = "/usr/bin/iceweasel";
49
 
+               
50
 
                private List<string> openSearchPluginDirectories;
51
 
                
52
 
                /// <summary>
53
 
@@ -82,11 +85,17 @@
54
 
                                // for installing in different directories. We could certainly shell
55
 
                                // out and call which or something...
56
 
                                string beginLibDir = "LIBDIR=";
57
 
-                               string binFile = "/usr/bin/firefox";
58
 
+                               string binFile = "";
59
 
                                string line, libDir;            
60
 
                                
61
 
                                libDir = null;
62
 
                                
63
 
+                               if (File.Exists (firefoxPath)) {
64
 
+                                       binFile = firefoxPath;
65
 
+                               } else if (File.Exists (iceweaselPath)) {
66
 
+                                       binFile = iceweaselPath;
67
 
+                               }
68
 
+                               
69
 
                                using (StreamReader r = File.OpenText (binFile)) {
70
 
                                        while (null != (line = r.ReadLine ())) {
71
 
                                                if (line.StartsWith (beginLibDir)) {
72
 
@@ -111,6 +120,18 @@
73
 
                        return null;
74
 
                }
75
 
                
76
 
+               private string UserBrowserPath {
77
 
+                       get {
78
 
+                               string mozillaPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), ".mozilla");
79
 
+                               if (Directory.Exists (Path.Combine (mozillaPath, "firefox"))) {
80
 
+                                   mozillaPath = Path.Combine (mozillaPath, "firefox");
81
 
+                               } else if (Directory.Exists (Path.Combine (mozillaPath, "iceweasel"))) {
82
 
+                                       mozillaPath = Path.Combine (mozillaPath, "iceweasel");
83
 
+                               }
84
 
+                               return mozillaPath;
85
 
+                       }
86
 
+               }
87
 
+                       
88
 
                /// <summary>
89
 
                /// Retrieves the profile plugin directory, which is where the 
90
 
                /// user installed OpenSearch plugins are located.
91
 
@@ -128,7 +149,7 @@
92
 
                                
93
 
                                profile = null;                         
94
 
                                
95
 
-                               profilePath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), ".mozilla/firefox/profiles.ini");
96
 
+                               profilePath = Path.Combine (UserBrowserPath, "profiles.ini");
97
 
                                using (StreamReader r = File.OpenText (profilePath)) {
98
 
                                        while (null != (line = r.ReadLine ())) {
99
 
                                                if (line.StartsWith (beginDefaultProfile)) break;
100
 
@@ -141,7 +162,7 @@
101
 
                                }
102
 
                                                        
103
 
                                if(profile != null) {
104
 
-                                       string path = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), ".mozilla/firefox");
105
 
+                                       string path = UserBrowserPath;
106
 
                                        path = Path.Combine (path, profile);
107
 
                                        path = Path.Combine (path, "searchplugins");
108