sam th --- [EMAIL PROTECTED] --- http://www.abisource.com/~sam/
OpenPGP Key: CABD33FC --- http://samth.dyndns.org/key
DeCSS: http://samth.dyndns.org/decss
>From [EMAIL PROTECTED] Wed Apr 18 16:37:13 2001
Return-Path: <[EMAIL PROTECTED]>
Delivered-To: [EMAIL PROTECTED]
Received: from fencepost.gnu.org (fencepost.gnu.org [199.232.76.164])
by parsons.abisource.com (Postfix) with ESMTP id DC87513B818
for <[EMAIL PROTECTED]>; Wed, 18 Apr 2001 16:37:12 -0500 (CDT)
Received: from proski by fencepost.gnu.org with local (Exim 3.16 #1 (Debian))
id 14pzdM-0006l4-00
for <[EMAIL PROTECTED]>; Wed, 18 Apr 2001 17:37:08 -0400
Date: Wed, 18 Apr 2001 17:38:10 -0400 (EDT)
From: Pavel Roskin <[EMAIL PROTECTED]>
X-X-Sender: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: Can't open american.hash
Message-ID: <[EMAIL PROTECTED]>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Hello!
The CVS version of Abiword for GTK compiled on RedHat 7.0 keeps printing
"Can't open american.hash"
As far as I understand, this comes from the linit() function in
abi/src/other/spell/xp/lookup.c
It prints exactly the filename that it tried to open, which means that it
tries to open "american.hash" without the full path.
Actually, AP_PREF_DEFAULT_SpellDirectory is defined but never used.
AP_PREF_KEY_SpellDirectory is used only in the Win32, BeOS and QNX
frontends.
The fix should be something like what I'm attaching, but it doesn't work
since lookup.c is written in C, not C++, hence no getAbiSuiteLibDir().
--
Regards,
Pavel Roskin
____________________________
--- src/other/spell/xp/lookup.c
+++ src/other/spell/xp/lookup.c
@@ -149,15 +149,28 @@ char *hashname; /* name of the hash file
int nextchar, x;
int viazero;
register ichar_t * cp;
+ char * full_hashname;
if (inited)
return 0;
- if ((fpHash = fopen (hashname, "rb")) == NULL)
+ full_hashname = malloc(strlen(XAP_App::getApp()->getAbiSuiteLibDir()) +
+ strlen(AP_PREF_DEFAULT_SpellDirectory) +
+ strlen(hashname) + 4);
+
+ sprintf(full_hashname, "%s/%s/%s",
+ XAP_App::getApp()->getAbiSuiteLibDir(),
+ AP_PREF_DEFAULT_SpellDirectory,
+ hashname);
+
+ if ((fpHash = fopen (full_hashname, "rb")) == NULL)
{
- (void) fprintf (stderr, CANT_OPEN, hashname);
+ (void) fprintf (stderr, CANT_OPEN, full_hashname);
+ free (full_hashname);
return (-1);
}
+
+ free (full_hashname);
hashsize = fread ((char *) &hashheader, 1, sizeof hashheader, fpHash);
if (hashsize < (int)sizeof(hashheader))
____________________________
PGP signature