HierarchicalFileList.st
changeset 4074 1e3e76541f13
parent 4072 27900655f254
child 4075 5f5eac2c8d22
equal deleted inserted replaced
4073:14b8653c124f 4074:1e3e76541f13
   410     "find last item which matches the path or file
   410     "find last item which matches the path or file
   411      returns the item or nil if not contained in self"
   411      returns the item or nil if not contained in self"
   412 
   412 
   413     |file searchItem rootComponents searchComponents|
   413     |file searchItem rootComponents searchComponents|
   414 
   414 
   415     (aPathOrFile isNil or:[root isNil]) ifTrue:[
   415     (aPathOrFile isNil or:[rootDir isNil]) ifTrue:[
   416         ^ nil
   416         ^ nil
   417     ].
   417     ].
   418 
   418 
   419     file := aPathOrFile asFilename.
   419     file := aPathOrFile asFilename.
   420     file exists ifFalse:[ ^ nil ].
   420     file exists ifFalse:[ ^ nil ].
   426         "not included"
   426         "not included"
   427         ^ nil
   427         ^ nil
   428     ].
   428     ].
   429     rootComponents   := rootDir components.
   429     rootComponents   := rootDir components.
   430     searchComponents := file asCanonicalizedFilename components.
   430     searchComponents := file asCanonicalizedFilename components.
   431     searchItem       := root.
   431     searchItem       := rootDir.
   432 
   432 
   433     searchComponents from:(rootComponents size + 1) do:[:aName| |child|
   433     searchComponents from:(rootComponents size + 1) do:[:aName| |child|
   434         child := searchItem detect:[:el| el baseName = aName ] ifNone:nil.
   434         child := searchItem detect:[:el| el baseName = aName ] ifNone:nil.
   435 
   435 
   436         child isNil ifTrue:[ ^ searchItem ].
   436         child isNil ifTrue:[ ^ searchItem ].
   437         searchItem := child.
   437         searchItem := child.
   438     ].
   438     ].
   439     ^ searchItem
   439     ^ searchItem
   440 
   440 
   441     "Modified: / 11-07-2010 / 11:46:59 / cg"
       
   442     "Created: / 07-09-2011 / 12:14:20 / cg"
   441     "Created: / 07-09-2011 / 12:14:20 / cg"
   443 ! !
   442 ! !
   444 
   443 
   445 !HierarchicalFileList methodsFor:'update'!
   444 !HierarchicalFileList methodsFor:'update'!
   446 
   445 
  1417 ! !
  1416 ! !
  1418 
  1417 
  1419 !HierarchicalFileList class methodsFor:'documentation'!
  1418 !HierarchicalFileList class methodsFor:'documentation'!
  1420 
  1419 
  1421 version
  1420 version
  1422     ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalFileList.st,v 1.76 2011-09-07 12:40:14 cg Exp $'
  1421     ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalFileList.st,v 1.77 2011-09-07 19:39:41 cg Exp $'
  1423 !
  1422 !
  1424 
  1423 
  1425 version_CVS
  1424 version_CVS
  1426     ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalFileList.st,v 1.76 2011-09-07 12:40:14 cg Exp $'
  1425     ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalFileList.st,v 1.77 2011-09-07 19:39:41 cg Exp $'
  1427 ! !
  1426 ! !
  1428 
  1427 
  1429 HierarchicalFileList::Directory initialize!
  1428 HierarchicalFileList::Directory initialize!