request-file/save/file in 1.2.47
[1/9] from: charles::mougel::spinodo::com at: 3-Sep-2005 16:07
Hi,
I have a problem with request-file/save/file
There is a bug in old versions, and we can't save in a file by default :
In View 1.2.47 this script doesn't work properly :
request-file/save/file %/C/test.txt
the filename field is void when the requester appears.
I found that this bug is resolved in the 1.3 !
I make a source of it, to make a patch, and past the code in a file.
Like that :
REBOL []
request-file: func [
{Requests a file using a popup list of files and directories.}
/title "Change heading on request."
title-line "Title line of request"
button-text "Button text for selection"
/file name "Default file name or block of file names"
/filter filt "Filter or block of filters"
/keep "Keep previous settings and results"
/only "Return only a single file, not a block."
/path "Return absolute path followed by relative files."
/save "Request file for saving, otherwise loading."
/local where data filt-names filt-values
][
if none? out start-out
either file [
either block? name [picked: copy name] [picked: reduce [to-file
name]]
] [
if not keep [picked: copy []]
]
if none? picked [picked: copy []]
if file: picked/1 [where: first split-path file]
while [not tail? picked] [
set [name file] split-path first picked
either name <> where [remove picked] [
change picked file
picked: next picked
]
]
picked: head picked
if any [not where not exists? where] [where: clean-path %.]
if not keep [
fp/data: head fp/data
so/data: head so/data
si: 1
]
either filter [
filters: either block? filt [filt] [reduce [filt]]
] [if any [not keep not block? filters] [pick-filter]]
ff/text: form filters
tt/text: either title [copy title-line] ["Select a File:"]
ob/text: either title [copy button-text] ["Select"]
if all [
error? done: try [
filt-names: copy head fp/data
filt-values: copy filter-list
either filter [
insert head filt-names "Custom"
insert/only filt-values filters
] [
filt-names: at filt-names index? fp/data
]
done: local-request-file data: reduce
[tt/text ob/text clean-path where picked filt-names
filt-values found? any [only] found? any [save]]
if done [
dir-path: data/3
picked: data/4
if not filter [fp/data: at head fp/data index? data/5]
]
done
]
(get in disarm done 'code) = 328
] [
done: false
read-dir/full either where [where] [dir-path]
show-pick
inform out
unfocus
]
if error? done [done]
if all [done picked any [path not empty? picked]] [
either path [
done: insert copy picked copy dir-path
either only [done/1] [head done]
] [
foreach file picked [insert file dir-path]
either only [picked/1] [picked]
]
]
]
request-file/save/file %/C/test.txt
And, argh !
** Script Error: out has no value
** Where: request-file
** Near: if none? out start-out
What can I do to patch this function in 1.2.47 or older ?
Is there anybody here, who can explain me where is the problem ? Why
'out and 'fp var aren't set ?
Thanks.
Charles.
[2/9] from: charles::mougel::spinodo::com at: 4-Sep-2005 9:10
Ingo, Thanks a lot, I will try.
I just want to ask :
- How do you know that ?
- How can we know/find that 'request-file has been defined in an object,
which has 'req-file as name ?
- Why 'request-file doesn't appear in this object ?
Charles.
Ingo Hohmann a =E9crit :
[3/9] from: SunandaDH:aol at: 4-Sep-2005 5:00
Charles:
> - How do you know that ?
Ingo can give you a definitive answer. I suspect he went exploring:
write %system.txt mold system true
Then read %system.txt in your favourite text editor and start hunting down
interesting internals.
Sunanda.
[4/9] from: antonr::lexicon::net at: 5-Sep-2005 0:49
To see all the objects defined in the global context:
? object!
That will list all the objects and you can find req-file
there. It is a quick first guess that pays off this time.
By the way, this seems to work, after defining the function,
bind its body to the req-file context.
bind second :request-file req-file
Anton.
[5/9] from: charles::mougel::spinodo::com at: 5-Sep-2005 9:40
Anton Rolls a =E9crit :
>By the way, this seems to work, after defining the function,
>bind its body to the req-file context.
>
> bind second :request-file req-file
>
>Anton.
>
Thanks for all, but I don't use 'bind very well :-(
Here is what I've done in view 1.2.47
req-file: make object! [(view 1.3 req-file version ...)
request-file: func [(view 1.3 request-file version ...)
bind second :request-file req-file
request-file/save/file %/c/test.txt
And this seems to work, the new function is used, ther is no crash with
variables with no values. This is ok.
But : the last line do exactly the same than if I doesn't do anything !
The dialog box show me the wrong directory, and doesn't feel the "file"
field.
So, this patch doesn't work.
Where is my 1.3 SDK ? boooooh ;-(
Charles.
[6/9] from: compkarori:gma:il at: 5-Sep-2005 20:08
Beta 1.3 SDK can be found on rebol.net
On 9/5/05, Spinodo - Charles Mougel <[charles--mougel--spinodo--com]> wrote:
>
> Where is my 1.3 SDK ? boooooh ;-(
>
> Charles.
> --
> To unsubscribe from the list, just send an email to
> lists at rebol.com with unsubscribe as the subject.
>
--
Graham Chiu
[7/9] from: charles:mougel:spinodo at: 5-Sep-2005 11:54
Graham Chiu a =E9crit :
>Beta 1.3 SDK can be found on rebol.net
>
Thanks, I've just look at http://www.rebol.net/builds/031/ and not read
all http://www.rebol.net/builds/
[8/9] from: compkarori::gmail::com at: 5-Sep-2005 22:04
Sorry, I forgot to mention that you have to place feedback asking for the SDK.
The URL is not listed.
On 9/5/05, Spinodo - Charles Mougel <[charles--mougel--spinodo--com]> wrote:
> Graham Chiu a =E9crit :
> >Beta 1.3 SDK can be found on rebol.net
<<quoted lines omitted: 4>>
> To unsubscribe from the list, just send an email to
> lists at rebol.com with unsubscribe as the subject.
--
Graham Chiu
[9/9] from: antonr:lexicon at: 6-Sep-2005 2:09
I looked into it a little more.
It looks to me like it was a problem of the
native LOCAL-REQUEST-FILE. Being a native!, we cannot
access its code.
Using this:
local-request-file reduce ["" "" %/d/anton/ [%newfile] [] [] true true]
I found that the first version in which the filename
of the non-existant file appears in the native requester
is View beta 1.2.57.3.1c.
But it looks like you found the SDK 1.3 beta. That should
work.
Anton.
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted