Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[library][request-dir] bug?

 [1/5] from: atruter::labyrinth::net::au at: 23-May-2004 14:29


Anyone else come across this strange behaviour?
>> system/version
== 1.2.10.3.1
>> save %a.txt "" >> write %a.txt "" >> request-dir
== none
>> save %a.txt ""
** Access Error: Bad file path: a.txt ** Near: save %a.txt ""
>> write %a.txt ""
** Access Error: Bad file path: a.txt ** Near: write %a.txt "" Regards, Ashley

 [2/5] from: antonr:lexicon at: 24-May-2004 1:09


It is a bug of request-dir. http://www.rebol.org/library/scripts/request-dir.r For some reason it is clipping off the final slash of the current directory. To see what I mean, issue what-dir before and after request-dir. The two lines of code which cause the problem are: if not all [keep path] [path: any [where what-dir]] if all [not empty? path slash = last path][remove back tail path] The first line should be making a copy of what-dir. The second line removes the slash, for reasons unknown. It is better to keep the final slash for a directory, in my opinion. Anton.

 [3/5] from: greggirwin:mindspring at: 23-May-2004 11:50


Anton et al, AR> It is better to keep the final slash for a directory, in AR> my opinion. In which case, we'd want to make sure that the slash is *always* there, correct? Anyone care to cast their votes about how this should behave? I'll be glad to collect results and pass them on to RT. -- Gregg

 [4/5] from: atruter:labyrinth:au at: 24-May-2004 9:24


Anton
> The second line removes the slash, for reasons unknown.
Agreed. Commenting this line out fixes the issue. I thought it might be a cut & paste error (from request-file) but no. Perhaps it is needed to address behavioural differences under other ports (Linux)?
> It is better to keep the final slash for a directory, in my opinion.
Under Windows at least, agreed. Gregg
> In which case, we'd want to make sure that the slash is *always* there, > correct? Anyone care to cast their votes about how this should behave?
As per above, I'd find out what problem was being addressed by this code before we ask RT to "fix" anything (although an obvious fix would be to have 'what-dir 'dirize its result). Regards, Ashley

 [5/5] from: antonr:lexicon at: 25-May-2004 1:57


RT once stressed that it is *very important* that directories keep their slash. It's not a Windows vs other platforms issue. The platform is rebol, so if there is a problem reading directory paths with a slash on some platforms, then that is an issue for RT to solve. We in rebol-land can just assume that all directories finish with a slash. I also don't think there is a need to contact RT about this minor matter. Let's just fix the code and resubmit to the library. The reason for the slash removal is probably just for display formatting purposes, I'd guess. Anton.