summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-02-15 17:11:37 -0500
committerDavid Thompson <dthompson2@worcester.edu>2014-02-16 10:46:58 -0500
commitb1ae9699b83faee738d92f39231d7f703866996c (patch)
tree4d8b224120e24a761a478bb4dc9c462824c02ba3
parent7b83863455ed697c22da14585781b9ab2eb8f242 (diff)
Throw error if shader file does not exist.
* 2d/shader.scm (load-shader): Add exception handling.
-rw-r--r--2d/shader.scm4
1 files changed, 3 insertions, 1 deletions
diff --git a/2d/shader.scm b/2d/shader.scm
index 8c47cdc..89b93fe 100644
--- a/2d/shader.scm
+++ b/2d/shader.scm
@@ -123,7 +123,9 @@ contained in the string SOURCE."
(define (load-shader type filename)
"Create a new GLSL shader of the given TYPE (vertex or fragment) and
compile the GLSL program stored in the file FILENAME."
- (make-shader type (call-with-input-file filename read-string)))
+ (if (file-exists? filename)
+ (make-shader type (call-with-input-file filename read-string))
+ (error "File not found!" filename)))
(define (load-vertex-shader filename)
"Create a new GLSL vertex shader and compile the GLSL program stored