Bug 1280757 - Load hyphenation from test profile directory r?sebastian draft
authorKrishna <k.krish@yahoo.com>
Wed, 29 Jun 2016 23:06:45 +0800
changeset 382392 b34d6d6df829edcacabadb67485c94fb78535f87
parent 382391 b69a5bbb5e40bd426e35222baa600b481e50d265
child 524174 ee2147c1ad06cb2d8335a50dce9b48ba65d56d99
push id21701
push userk.krish@yahoo.com
push dateWed, 29 Jun 2016 15:07:12 +0000
reviewerssebastian
bugs1280757
milestone50.0a1
Bug 1280757 - Load hyphenation from test profile directory r?sebastian MozReview-Commit-ID: 5xEJhXS35uZ
intl/hyphenation/glue/nsHyphenationManager.cpp
--- a/intl/hyphenation/glue/nsHyphenationManager.cpp
+++ b/intl/hyphenation/glue/nsHyphenationManager.cpp
@@ -14,16 +14,18 @@
 #include "nsDirectoryServiceDefs.h"
 #include "nsNetUtil.h"
 #include "nsUnicharUtils.h"
 #include "mozilla/Preferences.h"
 #include "nsZipArchive.h"
 #include "mozilla/Services.h"
 #include "nsIObserverService.h"
 #include "nsCRT.h"
+#include "nsAppDirectoryServiceDefs.h"
+#include "nsDirectoryServiceUtils.h"
 
 using namespace mozilla;
 
 static const char kIntlHyphenationAliasPrefix[] = "intl.hyphenation-alias.";
 static const char kMemoryPressureNotification[] = "memory-pressure";
 
 nsHyphenationManager *nsHyphenationManager::sInstance = nullptr;
 
@@ -163,16 +165,24 @@ nsHyphenationManager::LoadPatternList()
                    NS_GET_IID(nsIFile), getter_AddRefs(appDir));
   if (NS_SUCCEEDED(rv)) {
     appDir->AppendNative(NS_LITERAL_CSTRING("hyphenation"));
     bool equals;
     if (NS_SUCCEEDED(appDir->Equals(greDir, &equals)) && !equals) {
       LoadPatternListFromDir(appDir);
     }
   }
+
+  nsCOMPtr<nsIFile> profileDir;
+  rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_LOCAL_50_DIR,
+                                       getter_AddRefs(profileDir));
+  if (NS_SUCCEEDED(rv)) {
+      profileDir->AppendNative(NS_LITERAL_CSTRING("hyphenation"));
+      LoadPatternListFromDir(profileDir);
+  }
 }
 
 void
 nsHyphenationManager::LoadPatternListFromOmnijar(Omnijar::Type aType)
 {
   nsCString base;
   nsresult rv = Omnijar::GetURIString(aType, base);
   if (NS_FAILED(rv)) {