From 0780442e136e6c1e58920f1cdb1a9a476ea4fee0 Mon Sep 17 00:00:00 2001 From: Nunuhara Cabbage Date: Mon, 28 Mar 2022 17:54:26 -0700 Subject: [PATCH] Install debugger.scm to XSYS4_DATA_DIR --- meson.build | 7 ++++--- src/debugger.c | 7 ++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index 56fc094..a281424 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project('system4', 'c', default_options : ['c_std=c11']) add_project_arguments('-D_DEFAULT_SOURCE', language : 'c') -add_project_arguments('-DXSYS4_DATA_DIR="' + get_option('prefix') / 'share' / 'xsystem4"', language : 'c') +add_project_arguments('-DXSYS4_DATA_DIR="' + get_option('prefix') / get_option('datadir') / 'xsystem4"', language : 'c') zlib = dependency('zlib') libm = meson.get_compiler('c').find_library('m', required: false) @@ -36,5 +36,6 @@ libsys4_dep = libsys4_proj.get_variable('libsys4_dep') subdir('src') -install_subdir('shaders', install_dir : 'share' / 'xsystem4') -install_subdir('fonts', install_dir : 'share' / 'xsystem4') +install_subdir('shaders', install_dir : get_option('datadir') / 'xsystem4') +install_subdir('fonts', install_dir : get_option('datadir') / 'xsystem4') +install_data('debugger.scm', install_dir : get_option('datadir') / 'xsystem4') diff --git a/src/debugger.c b/src/debugger.c index 6c9031a..0655051 100644 --- a/src/debugger.c +++ b/src/debugger.c @@ -20,6 +20,7 @@ #include #include +#include "system4/file.h" #include "system4/instructions.h" #include "system4/string.h" #include "system4/utfsjis.h" @@ -239,7 +240,11 @@ void dbg_init(void) sexp_eval_string(dbg_ctx, "(define *prompt* (make-parameter \"dbg> \"))", -1, NULL); sexp_eval_string(dbg_ctx, "(define breakpoint-count (make-parameter 0))", -1, NULL); sexp_eval_string(dbg_ctx, "(define (repl-make-prompt m) (*prompt*))", -1, NULL); - sexp_eval_string(dbg_ctx, "(load \"./debugger.scm\")", -1, NULL); + + if (file_exists("./debugger.scm")) + sexp_eval_string(dbg_ctx, "(load \"./debugger.scm\")", -1, NULL); + else + sexp_eval_string(dbg_ctx, "(load \"" XSYS4_DATA_DIR "/debugger.scm\")", -1, NULL); } void dbg_fini(void)