[REBOL] Re: request-dir
From: atruter:hih:au at: 3-Sep-2002 12:27
Reply to self,
The following code (on windows) seems to do the trick:
<code>
request-dir: function [path] [where lst] [
view center-face layout [
where: info 300 form path
lst: text-list 300x200 data insert remove-each file read path [not dir? path/:file] %../
[
either path <> %/ [
path: dirize clean-path join path lst/picked/1
][
either not none? attempt [open dirize lst/picked/1] [
path: dirize lst/picked/1
][
alert "Device not ready."
]
]
lst/lines: remove-each file read path [not dir? path/:file]
if path <> %/ [insert lst/lines %../]
; Refresh list
clear lst/picked
lst/sld/data: 0
lst/sn: 0
lst/sld/redrag lst/lc / max 1 length? head lst/lines
show lst
; Refresh text
where/text: path
show where
]
btn "Select" [unview]
]
path
]
new-dir: request-dir %/c/rebol/
</code>
Note the use of "port" to determine whether removable media (typically %/a/
on windows) is actually present. Is this a good technique? (I don't know
whether using port without a matching close is *a bad thing* or not).
Regards,
Ashley