fixing HomePath on linux
This commit is contained in:
parent
4e4814e17a
commit
582a6b5c1f
|
@ -43,18 +43,20 @@ namespace SparkleLib {
|
||||||
if (GetConfigOption ("home_path") != null) {
|
if (GetConfigOption ("home_path") != null) {
|
||||||
return GetConfigOption ("home_path");
|
return GetConfigOption ("home_path");
|
||||||
|
|
||||||
} else {
|
} else if (SparkleHelpers.IsWindows) {
|
||||||
try {
|
try {
|
||||||
Environment.SpecialFolder folder =
|
Environment.SpecialFolder folder =
|
||||||
(Environment.SpecialFolder) Enum.Parse (
|
(Environment.SpecialFolder) Enum.Parse (
|
||||||
typeof(Environment.SpecialFolder), "UserProfile");
|
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");
|
Environment.GetFolderPath (Environment.SpecialFolder.Personal), "SparkleShare");
|
||||||
|
|
||||||
if (Directory.Exists (old_path) &&
|
if (Directory.Exists (old_path) &&
|
||||||
Environment.OSVersion.Platform == PlatformID.Win32NT) {
|
Environment.OSVersion.Platform == PlatformID.Win32NT) {
|
||||||
|
|
||||||
string new_path = Path.Combine (Environment.GetFolderPath (folder), "SparkleShare");
|
string new_path = Path.Combine (Environment.GetFolderPath (folder), "SparkleShare");
|
||||||
Directory.Move (old_path, new_path);
|
Directory.Move (old_path, new_path);
|
||||||
|
|
||||||
Console.WriteLine ("Migrated SparkleShare folder to %USERPROFILE%");
|
Console.WriteLine ("Migrated SparkleShare folder to %USERPROFILE%");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Console.WriteLine ("Failed to migrate: " + e.Message);
|
Console.WriteLine ("Failed to migrate: " + e.Message);
|
||||||
|
|
Loading…
Reference in a new issue