[racket] the program can't find image file

From: Noel Welsh (noelwelsh at gmail.com)
Date: Sun Oct 10 07:17:43 EDT 2010

Here is a working solution, where I have replaced the hero with a
picture I had on my hard disk:

#lang racket
(require 2htdp/universe)
(require 2htdp/image)

(require racket/gui/base)
(require racket/runtime-path)

(define-runtime-path here ".")

(define cauliflower
  (make-object image-snip%
    (make-object bitmap% (build-path here "programming/dct/cauliflower.jpg"))))

The root of the problem is that bitmap in 2htdp/image only allows you
to search in a few restricted paths. This seems a pretty silly
restriction. To work around it we had to implement what bitmap does
ourselves. Luckily this isn't hard.


Posted on the users mailing list.