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

[REBOL] Re: Getting version number of a Rebol Program.

From: antonr:iinet:au at: 22-May-2003 11:45

This is from my dir-utils.r library at version?: func ["Returns the version from the header of a rebol script." ;does not evaluate the header. file [file!] /local whitespace non-whitespace a b version ][ if not all [exists? file attempt [script? file]][return none] error? try [ return select second load/all file to-set-word "version" ; does not evaluate header ] error? try [ print "trying parse." non-whitespace: complement whitespace: charset " ^/^-" parse/all read file [ thru "rebol" thru "[" thru "version:" some whitespace a: some non-whitespace b: (version: copy/part a b) to end ] return to-tuple version ] ;error? try [ ;return get in first load/header %my-script.r 'version ; evaluates header (dangerous) ;] return none ] Anton Rolls.