From a7884fc1f15f86978064c60574dee0e20508b3a7 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Wed, 18 Apr 2012 16:33:16 +0200 Subject: [PATCH] config: return HomePath enum directly. #705 --- SparkleLib/SparkleConfig.cs | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/SparkleLib/SparkleConfig.cs b/SparkleLib/SparkleConfig.cs index 0536f098..0b051778 100755 --- a/SparkleLib/SparkleConfig.cs +++ b/SparkleLib/SparkleConfig.cs @@ -39,23 +39,12 @@ namespace SparkleLib { public string HomePath { get { - if (GetConfigOption ("home_path") != null) { + if (GetConfigOption ("home_path") != null) return GetConfigOption ("home_path"); - - } else if (SparkleHelpers.IsWindows) { - try { - Environment.SpecialFolder folder = - (Environment.SpecialFolder) Enum.Parse ( - typeof(Environment.SpecialFolder), "UserProfile"); - - return (Environment.GetFolderPath (folder)); - - } catch { - return Environment.GetFolderPath (Environment.SpecialFolder.Personal); - } - } else + else if (SparkleHelpers.IsWindows) + return Environment.GetFolderPath (Environment.SpecialFolder.UserProfile); + else return Environment.GetFolderPath (Environment.SpecialFolder.Personal); - } }