diff options
author | Moonchild <moonchild@palemoon.org> | 2022-05-09 22:38:16 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2022-05-09 22:38:16 +0000 |
commit | 9edf1b7bea5ff893f88911fc1a6a2dca3faeece9 (patch) | |
tree | 98bd9b0c7e3ca3e517e9e43dea157707b13f6bdb /extensions/spellcheck/hunspell/glue/mozHunspell.cpp | |
parent | 930ddd693be251c86ee904dafbaef38234b692c0 (diff) | |
download | uxp-9edf1b7bea5ff893f88911fc1a6a2dca3faeece9.tar.gz |
Issue #1896 - Port GetNativePath changes from GRE.getnativepath-work
Diffstat (limited to 'extensions/spellcheck/hunspell/glue/mozHunspell.cpp')
-rw-r--r-- | extensions/spellcheck/hunspell/glue/mozHunspell.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/extensions/spellcheck/hunspell/glue/mozHunspell.cpp b/extensions/spellcheck/hunspell/glue/mozHunspell.cpp index 87ffbc661f..1535529c8d 100644 --- a/extensions/spellcheck/hunspell/glue/mozHunspell.cpp +++ b/extensions/spellcheck/hunspell/glue/mozHunspell.cpp @@ -169,13 +169,20 @@ NS_IMETHODIMP mozHunspell::SetDictionary(const char16_t *aDictionary) nsAutoCString dictFileName, affFileName; - // XXX This isn't really good. nsIFile->NativePath isn't safe for all - // character sets on Windows. - // A better way would be to QI to nsIFile, and get a filehandle - // from there. Only problem is that hunspell wants a path - +#ifdef XP_WIN + // nsIFile->NativePath isn't safe for all character sets on Windows. + // Use GetPath and pass it as a UTF-8 to the hunspell lib instead. + // Hunspell 1.5+ supports UTF-8 file paths on Windows + // by prefixing "\\\\?\\". + nsAutoString affFileNameU; + nsresult rv = affFile->GetPath(affFileNameU); + NS_ENSURE_SUCCESS(rv, rv); + affFileName.AssignLiteral("\\\\?\\"); + AppendUTF16toUTF8(affFileNameU, affFileName); +#else nsresult rv = affFile->GetNativePath(affFileName); NS_ENSURE_SUCCESS(rv, rv); +#endif if (mAffixFileName.Equals(affFileName.get())) return NS_OK; |