Bug 1448071 - Support UNC paths for spell check dictionaries. r?masayuki
MozReview-Commit-ID: 5Ig2SZKf44R
--- a/extensions/spellcheck/hunspell/glue/mozHunspell.cpp
+++ b/extensions/spellcheck/hunspell/glue/mozHunspell.cpp
@@ -163,20 +163,27 @@ NS_IMETHODIMP mozHunspell::SetDictionary
return NS_ERROR_FILE_NOT_FOUND;
nsAutoCString dictFileName, affFileName;
#ifdef XP_WIN
nsAutoString affFileNameU;
nsresult rv = affFile->GetPath(affFileNameU);
NS_ENSURE_SUCCESS(rv, rv);
- // Hunspell 1.5+ supports UTF-8 file paths on Windows
+ // Hunspell 1.3.3+ supports UTF-8 file paths on Windows
// by prefixing "\\\\?\\".
- affFileName.AssignLiteral("\\\\?\\");
- AppendUTF16toUTF8(affFileNameU, affFileName);
+ if (StringBeginsWith(affFileNameU, NS_LITERAL_STRING("\\\\"))) {
+ CopyUTF16toUTF8(affFileNameU, affFileName);
+ if (affFileNameU.CharAt(2) != u'?') {
+ affFileName.InsertLiteral("?\\UNC\\", 2);
+ }
+ } else {
+ 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;