From 041353b40f09b636df7a41132f6f52216ae686f6 Mon Sep 17 00:00:00 2001 From: Jim Norman Date: Mon, 2 Apr 2007 19:36:39 +0000 Subject: [PATCH] Bug 249219. On windows, migrate .miCASA files to [homedir]\CASA. --- CASA/gui/Common.cs | 2 +- CASA/micasad/cache/SecretStore.cs | 25 ++++++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/CASA/gui/Common.cs b/CASA/gui/Common.cs index eaeb08b0..b695a34f 100644 --- a/CASA/gui/Common.cs +++ b/CASA/gui/Common.cs @@ -491,7 +491,7 @@ public class Common if (Common.IS_LINUX) return (config.GetConfigSetting(CONFIG_PERSISTENT_DIRECTORY, "/home/.casa/" + GetUserName())); else - return (config.GetConfigSetting(CONFIG_PERSISTENT_DIRECTORY, GetUserHomeDir())); + return (config.GetConfigSetting(CONFIG_PERSISTENT_DIRECTORY, GetUserHomeDir() + "\\CASA")); } internal static void SetUserPersistentDir(Config config, string sNewDirectory) diff --git a/CASA/micasad/cache/SecretStore.cs b/CASA/micasad/cache/SecretStore.cs index 0a63446c..081e2d6a 100644 --- a/CASA/micasad/cache/SecretStore.cs +++ b/CASA/micasad/cache/SecretStore.cs @@ -931,21 +931,28 @@ namespace sscs.cache } } } - -#if LINUX + m_persistenceDirectory = MigrateMiCasaFiles(); return m_persistenceDirectory; -#else - return GetUserHomeDirectory(); -#endif } internal string MigrateMiCasaFiles() - { + { + string sSeperator = "/"; +#if LINUX // for v1.7, we are storing MiCasa files in /home/.casa/[username] // let's migrate the files if needed - string sNewPath = POLICY_DIRECTORY + "/" + user.GetUserName(); - + string sNewPath = POLICY_DIRECTORY + "/" + user.GetUserName(); +#else + string sNewPath = GetUserHomeDirectory() + "\\CASA"; + + if (!Directory.Exists(sNewPath)) + { + Directory.CreateDirectory(sNewPath); + } + + sSeperator = "\\"; +#endif try { if (Directory.GetFiles(sNewPath, ".miCASA*").Length > 0) @@ -958,7 +965,7 @@ namespace sscs.cache { for (int i = 0; i < miCASAFiles.Length; i++) { - string sFileName = miCASAFiles[i].Substring(miCASAFiles[i].LastIndexOf("/")); + string sFileName = miCASAFiles[i].Substring(miCASAFiles[i].LastIndexOf(sSeperator)); File.Move(miCASAFiles[i], sNewPath + sFileName); } }