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

[REBOL] Re: Directory tools

From: jelinem1:nationwide at: 13-Apr-2001 8:30

My scheme to include external code is as follows. In my user.r I have: lib-path: %/d/languages/rebol/libs/ I place the "library" files in the directory specified above. Then in my code I simply write: include "highfun" include "mime-types" Oh yeah, the 'include word is defined by my shell.r script which is executed frim user.r. Just FYI its definition is: include: func [some-lib][ do rejoin [lib-path some-lib ".r"] ] Poking around the code in mime-type.r I see its intent (converting a path/url to an object) but 'source-as-object is still a file! when 'read tries to use it with the /full refinement. BTW the error is generated by the file! and not the url! (ftp://). I'll play with it more as time allows because everything is alot more fully featured that the quick hacks that I wrote and I'd really like to see it all work (and be able to use it!). Yes, the first thing I did was to use the /script refinement. I also want to see my program working as it is executing, thus /verbose. - Michael Jelinek Brett Handley <[brett--codeconscious--com]> on 04/12/2001 09:47:25 PM From: "Brett Handley" <[brett--codeconscious--com]> on 04/12/2001 09:47 PM Please respond to [rebol-list--rebol--com] Sent by: [rebol-bounce--rebol--com] To: <[rebol-list--rebol--com]> cc: Subject: [REBOL] Re: Directory tools
> Thanks for posting file-tools.r! I have been writing bits of it for
> as I needed them, and was currently balking at writing the > directory-related functions (esp copying).
You're most welcome. I noticed while writing this email that I had not included the top most target-directory in the copy-directory function. I've rectified this in the version on my website found at Looking at the code I'm wondering if it could be made a little more explicit. I'm also not sure now if it is handling relative FTP addressing properly. So I'll have to have another look at it. If you have some ideas I'd welcome them.
> I needed to modify the way that external code is included to use my own > scheme, no problem.
Is it a generic scheme? Maybe I should add as an option to the functions? :)
> I added a /verbose refinement to copy-directory. I want to see what my > script does to make sure it behaves itself!
Another way is to use the /script refinement to see the code that is produced.
> However, I'm getting the following error in mime-read. What is the
> of adding /full at the end of what should already be the full file path?
Inside mime-types.r there is a function called import-location-with-mime which given a file! or url! returns an object where the components of the file! or url! are in seperate fields. The /full refinement refers to a function in this object which puts all the pieces back together again to give you the original file! or url! (hopefully).
>> o: probe import-location-with-mime
%/d/html/eq/source/book-cod/about.r make object! [ path: %/d/html/eq/source/book-cod/ name: %about extension: %.r full: func [][rejoin [path name extension]] mime-type: func [][ get-mime-for-ext extension ] ]
>> o/full
== %/d/html/eq/source/book-cod/about.r
> >> retval: copy-directory/files/verbose %/d/html/eq/source/book-cod/ > ftp://user:[password--members--home--net]/source/book-cod/ > Copy Dir FROM: /d/html/eq/source/book-cod/ > TO: ftp://user:[password--members--home--net]/source/book-cod/ > - Copy file: about.r > ** Script Error: Invalid path value: full > ** Where: mime-read > ** Near: read source-as-object/full
source-as-object should have been an object! with a field-function (method) called "full", but it appears not. Maybe my import-location-as-mime function blew up in the face of your new scheme? Brett.