mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-23 11:51:27 +00:00
In load_cache() enclosed loading of archive in exception handling and
removed the writing of the archive previously done to update the format. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@17483 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
77629524c1
commit
d7530c2d26
1 changed files with 16 additions and 2 deletions
|
@ -35,6 +35,7 @@
|
|||
#include <GNUstepGUI/GSFontInfo.h>
|
||||
#include <Foundation/NSArchiver.h>
|
||||
#include <Foundation/NSBundle.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSFileManager.h>
|
||||
#include <Foundation/NSPathUtilities.h>
|
||||
#include <Foundation/NSProcessInfo.h>
|
||||
|
@ -134,7 +135,18 @@ load_cache(NSString *cacheName, BOOL async)
|
|||
NSNumber *v;
|
||||
id o;
|
||||
|
||||
o = [NSUnarchiver unarchiveObjectWithFile: cacheName];
|
||||
NS_DURING
|
||||
{
|
||||
o = [NSUnarchiver unarchiveObjectWithFile: cacheName];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
NSLog(@"Exception while attempting to load font cache file %@ - %@: %@",
|
||||
cacheName, [localException name], [localException reason]);
|
||||
o = nil;
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
|
||||
if ((o == nil)
|
||||
|| ((v = [o objectForKey: @"Version"]) == nil)
|
||||
|| ([v intValue] != 2))
|
||||
|
@ -173,7 +185,9 @@ load_cache(NSString *cacheName, BOOL async)
|
|||
else
|
||||
{
|
||||
// Ensure archive is written in latest format.
|
||||
[NSArchiver archiveRootObject: o toFile: cacheName];
|
||||
// No longer needed as NSString coding format did not change in
|
||||
// the last two years.
|
||||
//[NSArchiver archiveRootObject: o toFile: cacheName];
|
||||
}
|
||||
|
||||
ASSIGN(cache, o);
|
||||
|
|
Loading…
Reference in a new issue