fixing HomePath on linux

This commit is contained in:
Travis Glenn Hansen 2012-03-17 17:15:35 -06:00
parent 4e4814e17a
commit 582a6b5c1f

View file

@ -43,18 +43,20 @@ namespace SparkleLib {
if (GetConfigOption ("home_path") != null) {
return GetConfigOption ("home_path");
} else {
try {
Environment.SpecialFolder folder =
(Environment.SpecialFolder) Enum.Parse (
} else if (SparkleHelpers.IsWindows) {
try {
Environment.SpecialFolder folder =
(Environment.SpecialFolder) Enum.Parse (
typeof(Environment.SpecialFolder), "UserProfile");
return (Environment.GetFolderPath (folder));
return (Environment.GetFolderPath (folder));
} catch {
return Environment.GetFolderPath (Environment.SpecialFolder.Personal);
}
} else
return Environment.GetFolderPath (Environment.SpecialFolder.Personal);
} catch {
return Environment.GetFolderPath (Environment.SpecialFolder.Personal);
}
}
}
}
@ -78,14 +80,14 @@ namespace SparkleLib {
Environment.GetFolderPath (Environment.SpecialFolder.Personal), "SparkleShare");
if (Directory.Exists (old_path) &&
Environment.OSVersion.Platform == PlatformID.Win32NT) {
Environment.OSVersion.Platform == PlatformID.Win32NT) {
string new_path = Path.Combine (Environment.GetFolderPath (folder), "SparkleShare");
Directory.Move (old_path, new_path);
Console.WriteLine ("Migrated SparkleShare folder to %USERPROFILE%");
}
}
} catch (Exception e) {
Console.WriteLine ("Failed to migrate: " + e.Message);