Bug 249219. On windows, migrate .miCASA files to [homedir]\CASA.
This commit is contained in:
		| @@ -491,7 +491,7 @@ public class Common | |||||||
| 		if (Common.IS_LINUX) | 		if (Common.IS_LINUX) | ||||||
| 			return (config.GetConfigSetting(CONFIG_PERSISTENT_DIRECTORY, "/home/.casa/" + GetUserName())); | 			return (config.GetConfigSetting(CONFIG_PERSISTENT_DIRECTORY, "/home/.casa/" + GetUserName())); | ||||||
| 		else | 		else | ||||||
| 			return (config.GetConfigSetting(CONFIG_PERSISTENT_DIRECTORY, GetUserHomeDir())); | 			return (config.GetConfigSetting(CONFIG_PERSISTENT_DIRECTORY, GetUserHomeDir() + "\\CASA")); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	internal static void SetUserPersistentDir(Config config, string sNewDirectory) | 	internal static void SetUserPersistentDir(Config config, string sNewDirectory) | ||||||
|   | |||||||
							
								
								
									
										17
									
								
								CASA/micasad/cache/SecretStore.cs
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								CASA/micasad/cache/SecretStore.cs
									
									
									
									
										vendored
									
									
								
							| @@ -932,20 +932,27 @@ namespace sscs.cache | |||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
| 			 | 			 | ||||||
| #if LINUX			 |  | ||||||
| 			m_persistenceDirectory = MigrateMiCasaFiles(); | 			m_persistenceDirectory = MigrateMiCasaFiles(); | ||||||
| 			return m_persistenceDirectory; | 			return m_persistenceDirectory; | ||||||
| #else |  | ||||||
|             return GetUserHomeDirectory(); |  | ||||||
| #endif |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         internal string MigrateMiCasaFiles() |         internal string MigrateMiCasaFiles() | ||||||
|         { |         { | ||||||
|  |             string sSeperator = "/"; | ||||||
|  | #if LINUX | ||||||
|             // for v1.7, we are storing MiCasa files in /home/.casa/[username] |             // for v1.7, we are storing MiCasa files in /home/.casa/[username] | ||||||
|             // let's migrate the files if needed |             // 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 |             try | ||||||
|             { |             { | ||||||
|                 if (Directory.GetFiles(sNewPath, ".miCASA*").Length > 0) |                 if (Directory.GetFiles(sNewPath, ".miCASA*").Length > 0) | ||||||
| @@ -958,7 +965,7 @@ namespace sscs.cache | |||||||
|                 { |                 { | ||||||
|                     for (int i = 0; i < miCASAFiles.Length; i++) |                     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); |                         File.Move(miCASAFiles[i], sNewPath + sFileName); | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user