SIL.CoreImpl.SpellingHelper.AddAnySpellingExceptionsFromBackup C# (CSharp) Method

AddAnySpellingExceptionsFromBackup() public static method

Used in restoring backups, copy the specified file, typically an exc, to the hunspell directory
Will not overwrite any existing files. Exceptions for vernacular dictionaries are wiped out when the dictionary is initialized.
public static AddAnySpellingExceptionsFromBackup ( string backupPath ) : void
backupPath string
return void
		public static void AddAnySpellingExceptionsFromBackup(string backupPath)
		{
			AddAnySpellingExceptionsFromBackup(backupPath, GetSpellingDirectoryPath());
		}

Same methods

SpellingHelper::AddAnySpellingExceptionsFromBackup ( string backupDictionaryPath, string destinationPath ) : void

Usage Example

Ejemplo n.º 1
0
        public void EnchantDictionaryMigrated()
        {
            // make temp folder with enchant dictionary in it
            var outputFolder = Path.Combine(Path.GetTempPath(), "EnchantDictionaryMigrationTestOut");
            var inputFolder  = Path.Combine(Path.GetTempPath(), "EnchantDictionaryMigrationTestIn");

            DirectoryUtilities.DeleteDirectoryRobust(outputFolder);
            DirectoryUtilities.DeleteDirectoryRobust(inputFolder);
            Directory.CreateDirectory(outputFolder);
            Directory.CreateDirectory(inputFolder);
            File.AppendAllText(Path.Combine(inputFolder, "test.dic"), "nil");
            File.AppendAllText(Path.Combine(inputFolder, "test.exc"), "nil");
            // SUT
            Assert.DoesNotThrow(() => SpellingHelper.AddAnySpellingExceptionsFromBackup(inputFolder, outputFolder));
            // Verify that the correct files were copied
            Assert.True(File.Exists(Path.Combine(outputFolder, "test.exc")), "The exception file should have been copied.");
            Assert.False(File.Exists(Path.Combine(outputFolder, "test.dic")), "The .dic file should not have been copied.");
        }