diff options
| author | Almindor <Almindor@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2008-02-05 09:23:26 +0000 |
|---|---|---|
| committer | Almindor <Almindor@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2008-02-05 09:23:26 +0000 |
| commit | 5e74dbd54b3ac040585d3ba417dfe0477b34e36b (patch) | |
| tree | 8748eecc85b2d731cf708b31bc9d6cdb2f38cb0d /packages/aspell | |
| parent | 9153c62bb9d143ffa8c77be38fae6fcf63bf5239 (diff) | |
| download | fpc-5e74dbd54b3ac040585d3ba417dfe0477b34e36b.tar.gz | |
* hopefully fix windows aspell compilation
* fix also darwin/macosx libaspell.15.dylib location
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@10224 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/aspell')
| -rw-r--r-- | packages/aspell/src/aspell.pp | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/packages/aspell/src/aspell.pp b/packages/aspell/src/aspell.pp index aaee16333b..7591e606a6 100644 --- a/packages/aspell/src/aspell.pp +++ b/packages/aspell/src/aspell.pp @@ -24,7 +24,7 @@ uses {$ENDIF} {$IFDEF darwin} - const libaspell = 'libaspell.dylib'; + const libaspell = '/opt/local/lib/libaspell.15.dylib'; {$ENDIF} {$IFDEF windows} @@ -997,7 +997,7 @@ end; uses {$IFDEF WINDOWS} - SysUtils, + Windows, {$ENDIF} dynlibs; @@ -1005,6 +1005,35 @@ var LibHandle: TLibHandle = 0; AspellInited_: Boolean; +{$IFDEF WINDOWS} +function RegistryQueryValue (name,sub:shortstring):shortstring; +const + maxkeysize=255; +var + buf:string [maxkeysize]; + bufsize:int32; + buftype:int32; + res:int32; + key,rkey:hkey; + p,sp:pchar; + +begin + RegistryQueryValue:=''; + name:=name+#0; p:=@name[1]; + if sub='' then sp:=nil else begin sub:=sub+#0; sp:=@sub[1]; end; + bufsize:=maxkeysize; + buftype:=REG_SZ; + key:=HKEY_LOCAL_MACHINE; + res:=RegOpenKeyEx (key,p,0,KEY_QUERY_VALUE,rkey); + if res<>ERROR_SUCCESS then exit; + res:=RegQueryValueEx (rkey,sp,nil,@buftype,@buf[1],@bufsize); + if res<>ERROR_SUCCESS then exit; + buf[0]:=chr(bufsize-1); + RegCloseKey (rkey); + RegistryQueryValue:=buf; +end; +{$ENDIF} + function aspell_init(const libn: ansistring): Boolean; var libname: ansistring; @@ -1017,9 +1046,9 @@ begin libname := libn; {$IFDEF windows} - bversion := RegistryQueryValue(regLocalMachine,'SOFTWARE\Aspell','AspellVersion'); + bversion := RegistryQueryValue('SOFTWARE\Aspell','AspellVersion'); move(bversion[1], version, 4); - path := RegistryQueryValue(regLocalMachine,'SOFTWARE\Aspell','Path'); + path := RegistryQueryValue('SOFTWARE\Aspell','Path'); // will work if they passed %s, won't bork if they passed absolute libname := path + PathDelim + StringReplace(libn, '%s', IntToStr(Version), [rfReplaceAll]); {$ENDIF} |
