I realized I was wrong just after posting that email. Then I figured the way using environment variables, but hesitated because I never made the `create-embedding-executable` work if more arguments are passed to it.
Vincent's way delights me. On Fri, Jan 6, 2017 at 10:42 AM, Alex Harsanyi <[email protected]> wrote: > Perhaps I should have clarified this better, but > > My application is an executable built with "create-embedding-executable", > not a package, I'm not sure that the info.rkt can be compiled and packaged > inside an exe. > > I would like to have this information compiled as a .zo file and embedded > into this executable, so it cannot easily changed. My current solution is > writing a separate file which is read at run-time, similar to what you > proposed, but this has the downside that one can change the version just by > editing the file. > > For reference, the application is https://github.com/alex-hhh/ActivityLog2, > you can have a look at build.rkt for how it is currently done (it creates > the file build-id.txt). > > Cheers, > Alex. > > On Friday, January 6, 2017 at 10:31:43 AM UTC+8, WarGrey Gyoudmon Ju wrote: > > A racket application usually has an `info.rkt` file in the root > directory of the project/package/collection. > > see https://docs.racket-lang.org/raco/getinfo.html > > > > > > You can put your meta information in that file than read it with > (get-info/full dirpath) which returns a function that works like `hash-ref`. > > > > > > I recommend that way, there are also other alternatives. > > One that match your example is, just (write)ing a racket list into > "app-version.rktl" (note, "rktl" is also a conventional name, the "l" > stands for "load"), > > then you can (read) back it: > > > > > > > > (match-define (list app-version app-commit-id app-build-date) > > (with-handlers ([exn:fail:filesystem? (lambda [e] (list "dev build" > "unknown" "no build"))]) > > (call-with-input-file "app-version.rkt" read))) > > > > > > This alternative is simpler than the one using `info.rkt` when you > update the meta information programmatically. > > > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

