Hi!

Am 09.08.2006 um 11:30 schrieb Günther Noack:

B) The dict server can read from gzipped dictionaries, while DictionaryReader can't do that unless there's a gzip-transparent implementation for FileHandle. So DictionaryReader will probably need to gunzip and save its dictionaries to a local folder in any case.


I just looked at the NSFileHandle and GSFileHandle source code. Since I think it's useful for everybody who may need compression, I'll just post my results here:

When calling useCompression (right, it doesn't have a BOOL parameter) on a GNUstep file handle, it tries to put itself into on-the-fly- compression mode, returning YES if it worked. This is not possible with the OSX version of NSFileHandle, though. It's also not guaranteed that GNUstep is compiled with zlib support. So for real- world use, having a fallback solution on application level using the (omnipresent) gunzip tool is probably a good idea. ;-)

I'm currently thinking about something like that:

handle = [NSFileHandle fileHandleWithPath: aPath];
if ([handle useCompression] == NO) { // ouch, no compression support
        
        if (not already done) {
                // 1) copy file to home directory
                // 2) unzip the file there
        }
        
        // 3) handle = [NSFileHandle fileHandleWithPath: newUncompressedPath];
}

-Günther


_______________________________________________
Etoile-dev mailing list
[email protected]
https://mail.gna.org/listinfo/etoile-dev

Reply via email to