From: jsancho Date: Mon, 30 May 2011 23:30:30 +0000 (+0000) Subject: (no commit message) X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=79c3b8691b3e71310e768d404648d4da492e0253;p=gacela.git --- diff --git a/src/gacela.c b/src/gacela.c index 49e83a7..fc7ec31 100644 --- a/src/gacela.c +++ b/src/gacela.c @@ -39,30 +39,20 @@ init_gacela (void *data, int argc, char **argv) return NULL; } -void -load_scheme_file (char *path, char *filename) -{ - char fn[strlen (path) + 1024]; - - strcpy (fn, path); - strcat (fn, "/"); - strcat (fn, filename); - - scm_c_primitive_load (fn); -} - void load_scheme_files (char *path) { - load_scheme_file (path, "gacela.scm"); - load_scheme_file (path, "gacela_events.scm"); - load_scheme_file (path, "gacela_draw.scm"); - load_scheme_file (path, "gacela_ttf.scm"); + char load_path[strlen (path) + 1024]; + + sprintf (load_path, "(set! %%load-path (cons \"%s\" %%load-path))", path); + scm_c_eval_string (load_path); + scm_primitive_load_path (scm_from_locale_string ("gacela_loader.scm")); } int main (int argc, char *argv[]) { scm_with_guile (&init_gacela, NULL); + load_scheme_files (dirname (argv[0])); scm_shell (argc, argv); } diff --git a/src/gacela_loader.scm b/src/gacela_loader.scm new file mode 100644 index 0000000..4e82008 --- /dev/null +++ b/src/gacela_loader.scm @@ -0,0 +1,21 @@ +;;; Gacela, a GNU Guile extension for fast games development +;;; Copyright (C) 2009 by Javier Sancho Fernandez +;;; +;;; This program is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program. If not, see . + + +(primitive-load-path "gacela.scm") +(primitive-load-path "gacela_events.scm") +(primitive-load-path "gacela_draw.scm") +(primitive-load-path "gacela_ttf.scm")