file locator cleanup
authortimmy <timmy@timmy-desktop.(none)>
Sun, 7 Feb 2010 04:32:04 +0000 (23:32 -0500)
committertimmy <timmy@timmy-desktop.(none)>
Sun, 7 Feb 2010 04:32:04 +0000 (23:32 -0500)
src/core/file.slate
src/shell/shell.slate

index 7b9400b..e00208a 100644 (file)
@@ -419,11 +419,13 @@ l@(File Locator traits) readPathElementsFrom: s &pathSeparator: pathSeparator
   pathSeparator ifNil: [pathSeparator: l pathSeparator].
   pathElements: (s upToEnd splitWith: pathSeparator).
   l path: pathElements allButLast.
-  pathElements isEmpty
-    ifFalse:
-      [l name: (pathElements last copyUpToLast: l dot).
-       (pathElements last lastIndexOf: l dot)
-        ifNotNil: [l fileType: (pathElements last copyAfterLast: l dot)]].
+  pathElements isEmpty ifFalse: [l readFilenameFrom: pathElements last].
+].
+
+l@(File Locator traits) readFilenameFrom: s
+[
+  l name: (s copyUpToLast: l dot).
+  (s lastIndexOf: l dot) ifNotNil: [l fileType: (s copyAfterLast: l dot)].
 ].
 
 l@(File Locator traits) isRoot
index 05ba970..9382f2e 100644 (file)
@@ -13,13 +13,13 @@ l@(File Locator traits) maskedEntries: mask@(Regex Regex traits) do: block
 [ | matcher |
   matcher: (Regex Matcher newOn: mask).
   (Directory new `>> [locator: l. ]) reader reset
-    do: [|:each| (matcher match: each) = Regex Matcher Fail ifFalse: [block applyWith: l clone `>> [name: each. ]]].
+    do: [|:each| (matcher match: each) = Regex Matcher Fail ifFalse: [block applyWith: (l clone readFilenameFrom: each)]].
 ].
 
 l@(File Locator traits) maskedEntries: mask@(Shell MaskPattern traits) do: block
 [ 
   (Directory new `>> [locator: l. ]) reader reset
-    do: [|:each| (mask matches: each) ifTrue: [block applyWith: l clone `>> [name: each. ]]].
+    do: [|:each| (mask matches: each) ifTrue: [block applyWith: (l clone readFilenameFrom: each)]].
 ].