Closes #388 (closed).
The type is somewhat different from the one suggested in #388 (closed) so that the parameter is the whole tree. This makes it easier to do things depending on depth (e.g. expand the first two levels of the tree).
I'm not sure if we should refactor
selectFileTree to use this function. That would make it slower, though I don't know by how much, and it wouldn't make the code much clearer. But I can do that if somebody wants?
Small usage example (shows a tree just for directories, with
js selected and the root and
import StdEnv import Data.Func import Data.Tree import System.File import System.FilePath import iTasks import iTasks.Internal.SDS from iTasks.Extensions.Files import selectFileTreeWithShared Start w = doTasks t w t = get applicationName >>- \name -> get applicationDirectory >>- \dir -> selectFileTreeWithShared True (dir </> name+++"-www") (createReadOnlySDS \t iw -> (modTree True t,iw)) where modTree root (RNode (path,info) children) = RNode (path, info, dropDirectory path=="js", root || dropDirectory path=="css") (sortBy ((<) `on` \(RNode (p,_,_,_) _) -> p) [modTree False c \\ c=:RNode (path,info) _ <- children | include path info]) include path (Error _) = False include path (Ok info) = info.directory