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

GetDicPath() static private method

Get the path for the dictionary for a particular locale, if it is one of our private ones, given the path to the directory where we make them and the icuLocale.
static private GetDicPath ( string dirPath, string icuLocale ) : string
dirPath string
icuLocale string
return string
		internal static string GetDicPath(string dirPath, string icuLocale)
		{
			string filePath = Path.Combine(dirPath, icuLocale);
			return Path.ChangeExtension(filePath, ".dic");
		}

Usage Example

Ejemplo n.º 1
0
        public void EnsureDictionaryDoesNotOverwriteNonVernacularDictionary()
        {
            const string dictId   = "nonvern";
            const string testWord = "testWord";

            Directory.CreateDirectory(SpellingHelper.GetSpellingDirectoryPath());
            var filePath = SpellingHelper.GetDicPath(SpellingHelper.GetSpellingDirectoryPath(), dictId);

            // Wipe out any files related to our fake test dictionary
            File.Delete(SpellingHelper.GetExceptionFileName(filePath));
            File.Delete(filePath);
            File.Delete(Path.ChangeExtension(filePath, ".aff"));

            //build new fake test dictionary that is not vernacular
            var nonverndict = @"10" + Environment.NewLine + testWord + Environment.NewLine;
            var nonvernaff  = @"SET UTF-8" + Environment.NewLine + "KEEPCASE C" + Environment.NewLine;

            File.WriteAllText(filePath, nonverndict);
            File.WriteAllText(Path.ChangeExtension(filePath, ".aff"), nonvernaff);
            //SUT
            SpellingHelper.EnsureDictionary(dictId);
            //read back the hopefully unaffected dictionary
            var contents = File.ReadAllText(filePath);

            Assert.That(contents, Is.Not.StringContaining(SpellingHelper.PrototypeWord));
            Assert.That(contents, Contains.Substring(testWord));
        }
All Usage Examples Of SIL.CoreImpl.SpellingHelper::GetDicPath