FolderHierarchyModel

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

FolderHierarchyModel

Günther Schmidt
Hi,

has anybody yet played around a bit with the FolderHierarchyModel?

I've been doing stuff like:

|fhm|

fhm := FolderHierarchyModel new.

fhm addFolder:'/home/peter/www'.
fhm addFolder:'/home/peter/www/sebastian'.

.... etc.

which leads to duplicate entries for some folder in the hierarchy,
strangely enough not for all. The same is true when using Windows file
paths.

I've tried to fix this, without success so far.

Any clues anybody?

Günther


Reply | Threaded
Open this post in threaded view
|

Re: FolderHierarchyModel

Chris Uppal-3
Günther,

> fhm := FolderHierarchyModel new.
>
> fhm addFolder:'/home/peter/www'.
> fhm addFolder:'/home/peter/www/sebastian'.
>
> .... etc.
>
> which leads to duplicate entries for some folder in the hierarchy,
> strangely enough not for all.

I think that FolderHierarchyModel expects all its pathnames to be terminated by
a file separator.  I'm not sure whether that is just an undocumented
requirement, or if it's a bug that FHM doesn't use
    Folder appendPathDelimiter: aString
to force the argument to addFolder: into canonical form.

In any case the easiest fix is just to ensure that you always have folder names
in the normalised form (a good idea in itself IMO).  For instance your example
works fine if you say:

    fhm addFolder:'/home/peter/www/'.
    fhm addFolder:'/home/peter/www/sebastian/'.


    -- chris


Reply | Threaded
Open this post in threaded view
|

Re: FolderHierarchyModel

Günther Schmidt
Chris,

thanks!

That did the trick.

Günther