gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Deserializaton order


From: Richard Frith-Macdonald
Subject: Re: Deserializaton order
Date: Sun, 03 Apr 2005 07:15:35 +0100

On 2005-04-02 22:51:50 +0100 Frederico Muñoz <address@hidden> wrote:

> The problem I'm having is that when I deserialize the data into a 
> NSDictionary to perform the copy operations that filenames appear in random 
> order, which causes copyPath:toPath:withHandler to fail sometimes. The 
> problem is that if /Foo/bar/baz is copied first (apparently this method 
> creates all the dirsr in the path if they don't exist, although I'm having 
> problems with the return code when this happens) then when /Foo/bar, a 
> directory, is passed to the method it will fail, since the destination 
> mustn't exist.
> 
> I'm unsure how to implement this any other way, so any advices are greatly 
> welcome.

The order of keys in a dictionary is undefined (nothing to do with 
serialization ... that's the case wherever you use a dictionary or set) ... so 
you can't depend on key ordering. What you can do is simply serialize an 
additional object ... an array containing all the keys in the correct order ... 
so then to do the copy you simply deserialize both the dictionary and the 
array, then iterate through the array using the values as keys to obtain the 
files you need to copy.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]