If setenv() is present on Windows and variable BXSHARE is not set, use the
function get_builtin_variable() to set it up with either the value of the Bochs registry key or the BX_SHARE_PATH constant.
This commit is contained in:
parent
ec03c4bb53
commit
4ebe5e6879
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001-2016 The Bochs Project
|
||||
// Copyright (C) 2001-2017 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
@ -115,6 +115,7 @@ extern "C" {
|
||||
int bx_begin_simulation(int argc, char *argv[]);
|
||||
void bx_stop_simulation();
|
||||
char *bx_find_bochsrc(void);
|
||||
const char *get_builtin_variable(const char *varname);
|
||||
int bx_parse_cmdline(int arg, int argc, char *argv[]);
|
||||
int bx_read_configuration(const char *rcfile);
|
||||
int bx_write_configuration(const char *rcfile, int overwrite);
|
||||
|
@ -45,7 +45,6 @@ Bit8u bx_user_plugin_count = 0;
|
||||
|
||||
extern bx_debug_t bx_dbg;
|
||||
|
||||
static const char *get_builtin_variable(const char *varname);
|
||||
static int parse_line_unformatted(const char *context, char *line);
|
||||
static int parse_line_formatted(const char *context, int num_params, char *params[]);
|
||||
static int parse_bochsrc(const char *rcfile);
|
||||
@ -1849,7 +1848,7 @@ static int parse_bochsrc(const char *rcfile)
|
||||
return retval;
|
||||
}
|
||||
|
||||
static const char *get_builtin_variable(const char *varname)
|
||||
const char *get_builtin_variable(const char *varname)
|
||||
{
|
||||
#ifdef WIN32
|
||||
int code;
|
||||
|
@ -855,9 +855,15 @@ int bx_init_main(int argc, char *argv[])
|
||||
if (getenv("BXSHARE") != NULL) {
|
||||
BX_INFO(("BXSHARE is set to '%s'", getenv("BXSHARE")));
|
||||
} else {
|
||||
#ifdef WIN32
|
||||
BX_INFO(("BXSHARE not set. using system default '%s'",
|
||||
get_builtin_variable("BXSHARE")));
|
||||
setenv("BXSHARE", get_builtin_variable("BXSHARE"), 1);
|
||||
#else
|
||||
BX_INFO(("BXSHARE not set. using compile time default '%s'",
|
||||
BX_SHARE_PATH));
|
||||
setenv("BXSHARE", BX_SHARE_PATH, 1);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
// we don't have getenv or setenv. Do nothing.
|
||||
|
Loading…
x
Reference in New Issue
Block a user