1
0
Fork 0
forked from Miroirs/x49gp

config_lua_filename is local

This commit is contained in:
Gwenhael Le Moine 2024-11-14 15:46:23 +01:00
parent 697dadda7d
commit 93132e2702
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
2 changed files with 5 additions and 9 deletions

View file

@ -14,8 +14,7 @@
struct options opt = {
.datadir = NULL,
.config_lua_filename = NULL,
.state_filename = NULL,
.debug_port = 0,
.start_debugger = false,
.reinit = X49GP_REINIT_NONE,
@ -117,8 +116,6 @@ void config_init( char* progname, int argc, char* argv[] )
int option_index;
int c = '?';
char* config_lua_filename = ( char* )"config.lua";
bool do_enable_debugger = false;
bool do_start_debugger = false;
bool do_reflash = false;
@ -255,14 +252,14 @@ void config_init( char* progname, int argc, char* argv[] )
opt.datadir = g_build_filename( user_config_dir, progname, NULL );
}
opt.config_lua_filename = g_build_filename( opt.datadir, config_lua_filename, NULL );
const char* config_lua_filename = g_build_filename( opt.datadir, "config.lua", NULL );
opt.state_filename = g_build_filename( opt.datadir, "state", NULL );
/**********************/
/* 1. read config.lua */
/**********************/
bool haz_config_file = config_read( opt.config_lua_filename );
bool haz_config_file = config_read( config_lua_filename );
if ( haz_config_file ) {
lua_getglobal( config_lua_values, "newrpl_keyboard" );
opt.newrpl = lua_toboolean( config_lua_values, -1 );
@ -325,9 +322,9 @@ void config_init( char* progname, int argc, char* argv[] )
print_config();
if ( !haz_config_file ) {
fprintf( stderr, "\nConfiguration file %s doesn't seem to exist or is invalid!\n", opt.config_lua_filename );
fprintf( stderr, "\nConfiguration file %s doesn't seem to exist or is invalid!\n", config_lua_filename );
fprintf( stderr, "You can solve this by running `mkdir -p %s/ && %s --print-config >> %s`\n\n", opt.datadir, progname,
opt.config_lua_filename );
config_lua_filename );
}
if ( do_enable_debugger ) {

View file

@ -31,7 +31,6 @@ struct options {
char* font;
int display_scale;
int font_size;
char* config_lua_filename;
bool verbose;
char* datadir;