~ubuntu-branches/ubuntu/precise/gnome-do/precise-proposed

« back to all changes in this revision

Viewing changes to Do.Addins/src/Paths.cs

  • Committer: Bazaar Package Importer
  • Author(s): Christopher James Halse Rogers
  • Date: 2008-09-14 10:09:40 UTC
  • mto: (0.1.8 sid)
  • mto: This revision was merged to the branch mainline in revision 7.
  • Revision ID: james.westby@ubuntu.com-20080914100940-kyghudg7py14bu2z
Tags: upstream-0.6.0.0
ImportĀ upstreamĀ versionĀ 0.6.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
 
33
33
                static Paths ()
34
34
                {
35
 
                        if (File.Exists (Temp)) {
 
35
                        if (Directory.Exists (Temp)) {
36
36
                                try {
37
 
                                        File.Delete (Temp);
 
37
                                        Directory.Delete (Temp, true);
38
38
                                } catch (Exception e) {
39
 
                                        Console.Error.WriteLine ("Could not delete temporary directory {0}: {1}",
 
39
                                        Console.Error.WriteLine (
 
40
                                                "Could not delete temporary directory {0}: {1}",
40
41
                                                Temp, e.Message);
41
42
                                }
42
43
                        }
43
 
 
44
44
                        CreateDirs (ApplicationData, UserData, UserPlugins, Temp);
45
45
                }
46
46
 
50
50
                                try {
51
51
                                        Directory.CreateDirectory (first);
52
52
                                } catch (Exception e) {
53
 
                                        Console.Error.WriteLine ("Failed to create directory {0}: {1}",
 
53
                                        Console.Error.WriteLine (
 
54
                                                "Failed to create directory {0}: {1}",
54
55
                                                first, e.Message);
55
56
                                }
56
57
                        }
60
61
                                        try {
61
62
                                                Directory.CreateDirectory (dir);
62
63
                                        } catch (Exception e) {
63
 
                                                Console.Error.WriteLine ("Failed to create directory {0}: {1}",
 
64
                                                Console.Error.WriteLine (
 
65
                                                        "Failed to create directory {0}: {1}",
64
66
                                                        dir, e.Message);
65
67
                                        }
66
68
                                }
136
138
 
137
139
                public static string UserHome {
138
140
                        get {
139
 
 
140
141
                                string home = Environment.GetEnvironmentVariable ("HOME");
141
142
                                if (string.IsNullOrEmpty (home))
142
143
                                        home = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
147
148
                public static string Temp {
148
149
                        get { return Combine (Paths.ApplicationData, "tmp"); }
149
150
                }
150
 
 
 
151
                
151
152
                public static string GetTemporaryFilePath ()
152
153
                {
153
154
                        int fileId;
172
173
                }
173
174
 
174
175
                public static string UserPlugins {
175
 
                        get { return Combine (UserData, "plugins"); }
 
176
                        get { return Combine (UserData, "plugins-" + Version); }
176
177
                }
177
178
 
178
179
                public static string[] SystemData {
201
202
                                return dirs;
202
203
                        }
203
204
                }
 
205
 
 
206
                private static string Version {
 
207
                        get {
 
208
                                System.Reflection.AssemblyName name;
 
209
 
 
210
                                name = typeof (Paths).Assembly.GetName ();
 
211
                                return string.Format ("{0}.{1}.{2}",
 
212
                                        name.Version.Major, name.Version.Minor, name.Version.Build);
 
213
                        }
 
214
                }
204
215
        }
205
216
}
206
217