Bug 249219. On windows, migrate .miCASA files to [homedir]\CASA.

This commit is contained in:
Jim Norman 2007-04-02 19:36:39 +00:00
parent a37d1294aa
commit 041353b40f
2 changed files with 17 additions and 10 deletions

View File

@ -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)

View File

@ -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);
}
}