This is a patch for the Help-not-showing-up bug (1545). The solution I
implemented was to try to open the localised help, and if not available,
fall back to the en-US help...

Bye!
  Marc aka Uwog


Index: abi/src/wp/ap/xp/ap_EditMethods.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/xp/ap_EditMethods.cpp,v
retrieving revision 1.417
diff -u -r1.417 ap_EditMethods.cpp
--- abi/src/wp/ap/xp/ap_EditMethods.cpp 2001/12/17 03:16:17     1.417
+++ abi/src/wp/ap/xp/ap_EditMethods.cpp 2001/12/17 15:24:27
@@ -95,6 +95,7 @@
 #include "ie_types.h"
 
 #include "ut_Script.h"
+#include "ut_path.h"
 
 /*****************************************************************/
 /*****************************************************************/
@@ -2305,9 +2306,9 @@
 
        const char * abiSuiteLibDir = pApp->getAbiSuiteLibDir();
        const XML_Char * abiSuiteLocString = NULL;
-       char *helpURL, *tmpURL;
+       char *helpURL, *tmpURL, *testURL;
 
-       helpURL = tmpURL = NULL;
+       helpURL = tmpURL = testURL = NULL;
        pPrefs->getPrefsValue((XML_Char*)AP_PREF_KEY_StringSet, &abiSuiteLocString);
 
        if (bLocal)
@@ -2315,9 +2316,28 @@
                tmpURL = helpURL = UT_catPathname("file://", abiSuiteLibDir);
                helpURL = UT_catPathname(helpURL, pathBeforeLang);
                FREEP(tmpURL);
+
+               // check the existence of the localised help directory
+               tmpURL = testURL = UT_catPathname(abiSuiteLibDir, pathBeforeLang);
+               testURL = UT_catPathname(testURL, abiSuiteLocString);
+               FREEP(tmpURL);
                tmpURL = helpURL;
-               helpURL = UT_catPathname(helpURL, abiSuiteLocString);
+               if (directoryExists(testURL))
+               {
+                   // the localised help exists, so use it
+                   helpURL = UT_catPathname(helpURL, abiSuiteLocString);
+                   UT_DEBUGMSG("help does not exist\n");
+               }
+               else
+               {
+                   // the localised help directory does not exist, so fall back to the
+                   // en-US help localtion, which should always be available
+                   helpURL = UT_catPathname(helpURL, "en-US");
+                   UT_DEBUGMSG("help does not exist\n");
+               }
+               FREEP(testURL);
                FREEP(tmpURL);
+               
                tmpURL = helpURL;
                helpURL = UT_catPathname(helpURL, pathAfterLang);
                FREEP(tmpURL);
Index: abi/src/af/util/unix/ut_path.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/util/unix/ut_path.cpp,v
retrieving revision 1.2
diff -u -r1.2 ut_path.cpp
--- abi/src/af/util/unix/ut_path.cpp    2001/08/30 06:52:43     1.2
+++ abi/src/af/util/unix/ut_path.cpp    2001/12/17 15:24:04
@@ -20,6 +20,8 @@
 
 #include "ut_path.h"
 #include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
 
 /*!    This function takes a char* representing a path to a file and returns
        the pointer to the string which represents the base portion of the path.
@@ -37,4 +39,21 @@
                str = &path[--len];
 
        return str;
+}
+
+/*!
+       if dir is an existing directory, this function
+       returns true, otherwise, it returns false
+*/
+
+bool directoryExists(const char* dir)
+{
+    struct stat buf;
+    
+    if (lstat(dir, &buf) != -1)
+    {
+       return buf.st_mode & S_IFDIR;
+    }
+    
+    return false;
 }
Index: abi/src/af/util/beos/ut_path.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/util/beos/ut_path.cpp,v
retrieving revision 1.2
diff -u -r1.2 ut_path.cpp
--- abi/src/af/util/beos/ut_path.cpp    2001/08/30 06:52:42     1.2
+++ abi/src/af/util/beos/ut_path.cpp    2001/12/17 15:24:03
@@ -38,3 +38,14 @@
 
        return str;
 }
+
+/*!
+       if dir is an existing directory, this function
+       returns true, otherwise, it returns false
+*/
+
+bool directoryExists(const char* dir)
+{
+    UT_DEBUGMSG("fixme: implement directoryExists() in src/af/util/beos/ut_path.cpp");
+    return true;
+}
Index: abi/src/af/util/mac/ut_path.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/util/mac/ut_path.cpp,v
retrieving revision 1.2
diff -u -r1.2 ut_path.cpp
--- abi/src/af/util/mac/ut_path.cpp     2001/08/30 06:52:42     1.2
+++ abi/src/af/util/mac/ut_path.cpp     2001/12/17 15:30:51
@@ -38,3 +38,14 @@
 
        return str;
 }
+
+/*!
+       if dir is an existing directory, this function
+       returns true, otherwise, it returns false
+*/
+
+bool directoryExists(const char* dir)
+{
+    UT_DEBUGMSG("fixme: implement directoryExists() in src/af/util/mac/ut_path.cpp");
+    return true;
+}
Index: abi/src/af/util/qnx/ut_path.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/util/qnx/ut_path.cpp,v
retrieving revision 1.2
diff -u -r1.2 ut_path.cpp
--- abi/src/af/util/qnx/ut_path.cpp     2001/08/30 06:52:43     1.2
+++ abi/src/af/util/qnx/ut_path.cpp     2001/12/17 15:24:04
@@ -38,3 +38,14 @@
 
        return str;
 }
+
+/*!
+       if dir is an existing directory, this function
+       returns true, otherwise, it returns false
+*/
+
+bool directoryExists(const char* dir)
+{
+    UT_DEBUGMSG("fixme: implement directoryExists() in src/af/util/qnx/ut_path.cpp");
+    return true;
+}
Index: abi/src/af/util/win/ut_path.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/util/win/ut_path.cpp,v
retrieving revision 1.2
diff -u -r1.2 ut_path.cpp
--- abi/src/af/util/win/ut_path.cpp     2001/08/30 06:52:44     1.2
+++ abi/src/af/util/win/ut_path.cpp     2001/12/17 15:24:04
@@ -38,3 +38,14 @@
 
        return str;
 }
+
+/*!
+       if dit is an existing directory, this function
+       returns true, otherwise, it returns false
+*/
+
+bool directoryExists(const char* dir)
+{
+    UT_DEBUGMSG("fixme: implement directoryExists() in src/af/util/win/ut_path.cpp");
+    return true;
+}
Index: abi/src/af/util/xp/ut_path.h
===================================================================
RCS file: /cvsroot/abi/src/af/util/xp/ut_path.h,v
retrieving revision 1.2
diff -u -r1.2 ut_path.h
--- abi/src/af/util/xp/ut_path.h        2001/08/30 06:52:44     1.2
+++ abi/src/af/util/xp/ut_path.h        2001/12/17 15:24:04
@@ -22,4 +22,6 @@
 
 const char* UT_basename(const char* path);
 
+bool directoryExists(const char* dir);
+
 #endif /* UT_PATH_H */

Reply via email to