1
0
Fork 0
forked from Miroirs/x49gp

hardcode state file name

This commit is contained in:
Gwenhael Le Moine 2024-11-20 14:48:52 +01:00
parent 78902ca527
commit 6381ab9d29
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
4 changed files with 8 additions and 7 deletions

View file

@ -10,6 +10,8 @@
#include "x49gp.h" #include "x49gp.h"
#include "options.h" #include "options.h"
#define STATE_FILE_NAME "state"
int x49gp_modules_init( x49gp_t* x49gp ) int x49gp_modules_init( x49gp_t* x49gp )
{ {
x49gp_module_t* module; x49gp_module_t* module;
@ -85,11 +87,12 @@ int x49gp_modules_reset( x49gp_t* x49gp, x49gp_reset_t reset )
return 0; return 0;
} }
int x49gp_modules_load( x49gp_t* x49gp, const char* filename ) int x49gp_modules_load( x49gp_t* x49gp )
{ {
x49gp_module_t* module; x49gp_module_t* module;
GError* gerror = NULL; GError* gerror = NULL;
int error, result; int error, result;
const char* filename = g_build_filename( opt.datadir, STATE_FILE_NAME, NULL );
#ifdef DEBUG_X49GP_MODULES #ifdef DEBUG_X49GP_MODULES
printf( "%s:%u:\n", __FUNCTION__, __LINE__ ); printf( "%s:%u:\n", __FUNCTION__, __LINE__ );
@ -140,7 +143,7 @@ int x49gp_modules_load( x49gp_t* x49gp, const char* filename )
return result; return result;
} }
int x49gp_modules_save( x49gp_t* x49gp, const char* filename ) int x49gp_modules_save( x49gp_t* x49gp )
{ {
x49gp_module_t* module; x49gp_module_t* module;
GError* gerror = NULL; GError* gerror = NULL;
@ -148,6 +151,7 @@ int x49gp_modules_save( x49gp_t* x49gp, const char* filename )
gsize length; gsize length;
int error; int error;
int fd; int fd;
const char* filename = g_build_filename( opt.datadir, STATE_FILE_NAME, NULL );
#ifdef DEBUG_X49GP_MODULES #ifdef DEBUG_X49GP_MODULES
printf( "%s:%u:\n", __FUNCTION__, __LINE__ ); printf( "%s:%u:\n", __FUNCTION__, __LINE__ );

View file

@ -249,8 +249,6 @@ void config_init( char* progname, int argc, char* argv[] )
const char* config_lua_filename = g_build_filename( opt.datadir, "config.lua", 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 */ /* 1. read config.lua */
/**********************/ /**********************/

View file

@ -18,7 +18,6 @@
typedef enum { MODEL_49GP = 0, MODEL_50G } x50ng_model_t; typedef enum { MODEL_49GP = 0, MODEL_50G } x50ng_model_t;
struct options { struct options {
char* state_filename;
int debug_port; int debug_port;
int start_debugger; int start_debugger;
char* firmware; char* firmware;

View file

@ -118,8 +118,8 @@ extern int s3c2410_sdi_is_mounted( x49gp_t* x49gp );
extern int x49gp_modules_init( x49gp_t* ); extern int x49gp_modules_init( x49gp_t* );
extern int x49gp_modules_exit( x49gp_t* ); extern int x49gp_modules_exit( x49gp_t* );
extern int x49gp_modules_reset( x49gp_t*, x49gp_reset_t ); extern int x49gp_modules_reset( x49gp_t*, x49gp_reset_t );
extern int x49gp_modules_load( x49gp_t*, const char* ); extern int x49gp_modules_load( x49gp_t* );
extern int x49gp_modules_save( x49gp_t*, const char* ); extern int x49gp_modules_save( x49gp_t* );
extern int x49gp_flash_init( x49gp_t* ); extern int x49gp_flash_init( x49gp_t* );
extern int x49gp_sram_init( x49gp_t* ); extern int x49gp_sram_init( x49gp_t* );