mirror of
https://github.com/mauiaaron/apple2.git
synced 2024-09-29 08:55:06 +00:00
Fix HOMEDIR on mobile devices
This commit is contained in:
parent
b4925292e1
commit
59e6c4fabc
@ -407,7 +407,7 @@ void c_interface_select_diskette( int drive )
|
|||||||
if (entries <= 0)
|
if (entries <= 0)
|
||||||
{
|
{
|
||||||
DISKERR_SHOWERR("Problem reading directory");
|
DISKERR_SHOWERR("Problem reading directory");
|
||||||
snprintf(disk_path, PATH_MAX, "%s", getenv("HOME"));
|
snprintf(disk_path, PATH_MAX, "%s", HOMEDIR);
|
||||||
nextdir = true;
|
nextdir = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1545,7 +1545,7 @@ static void *interface_thread(void *current_key)
|
|||||||
char *path = NULL;
|
char *path = NULL;
|
||||||
prefs_copyStringValue(PREF_DOMAIN_INTERFACE, PREF_DISK_PATH, &path);
|
prefs_copyStringValue(PREF_DOMAIN_INTERFACE, PREF_DISK_PATH, &path);
|
||||||
if (!path) {
|
if (!path) {
|
||||||
ASPRINTF(&path, "%s", getenv("HOME"));
|
ASPRINTF(&path, "%s", HOMEDIR);
|
||||||
}
|
}
|
||||||
strncpy(disk_path, path, PATH_MAX-1);
|
strncpy(disk_path, path, PATH_MAX-1);
|
||||||
disk_path[PATH_MAX-1] = '\0';
|
disk_path[PATH_MAX-1] = '\0';
|
||||||
|
@ -2366,7 +2366,7 @@ YY_RULE_SETUP
|
|||||||
{
|
{
|
||||||
#if CPU_TRACING
|
#if CPU_TRACING
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
asprintf(&buf, "%s/%s", getenv("HOME"), "cputrace.txt");
|
asprintf(&buf, "%s/%s", HOMEDIR, "cputrace.txt");
|
||||||
cpu65_trace_toggle(buf);
|
cpu65_trace_toggle(buf);
|
||||||
FREE(buf);
|
FREE(buf);
|
||||||
#else
|
#else
|
||||||
@ -2381,7 +2381,7 @@ YY_RULE_SETUP
|
|||||||
{
|
{
|
||||||
#if DISK_TRACING
|
#if DISK_TRACING
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
asprintf(&buf, "%s/%s", getenv("HOME"), "disktrace.txt");
|
asprintf(&buf, "%s/%s", HOMEDIR, "disktrace.txt");
|
||||||
c_toggle_disk_trace_6(buf, NULL);
|
c_toggle_disk_trace_6(buf, NULL);
|
||||||
FREE(buf);
|
FREE(buf);
|
||||||
#else
|
#else
|
||||||
|
@ -852,7 +852,7 @@ ADDRS [0-9a-fA-F]+
|
|||||||
{BOS}cput?r?a?c?e?{EOS} {
|
{BOS}cput?r?a?c?e?{EOS} {
|
||||||
#if CPU_TRACING
|
#if CPU_TRACING
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
asprintf(&buf, "%s/%s", getenv("HOME"), "cputrace.txt");
|
asprintf(&buf, "%s/%s", HOMEDIR, "cputrace.txt");
|
||||||
cpu65_trace_toggle(buf);
|
cpu65_trace_toggle(buf);
|
||||||
FREE(buf);
|
FREE(buf);
|
||||||
#else
|
#else
|
||||||
@ -863,7 +863,7 @@ ADDRS [0-9a-fA-F]+
|
|||||||
{BOS}diskt?r?a?c?e?{EOS} {
|
{BOS}diskt?r?a?c?e?{EOS} {
|
||||||
#if DISK_TRACING
|
#if DISK_TRACING
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
asprintf(&buf, "%s/%s", getenv("HOME"), "disktrace.txt");
|
asprintf(&buf, "%s/%s", HOMEDIR, "disktrace.txt");
|
||||||
c_toggle_disk_trace_6(buf, NULL);
|
c_toggle_disk_trace_6(buf, NULL);
|
||||||
FREE(buf);
|
FREE(buf);
|
||||||
#else
|
#else
|
||||||
|
@ -25,6 +25,12 @@ enum {
|
|||||||
// top installation directory
|
// top installation directory
|
||||||
extern const char *data_dir;
|
extern const char *data_dir;
|
||||||
|
|
||||||
|
#if MOBILE_DEVICE
|
||||||
|
# define HOMEDIR data_dir
|
||||||
|
#else
|
||||||
|
# define HOMEDIR getenv("HOME")
|
||||||
|
#endif
|
||||||
|
|
||||||
// global ref to CLI args
|
// global ref to CLI args
|
||||||
extern char **argv;
|
extern char **argv;
|
||||||
extern int argc;
|
extern int argc;
|
||||||
|
@ -47,7 +47,7 @@ void prefs_load(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!prefsFile) {
|
if (!prefsFile) {
|
||||||
ASPRINTF(&prefsFile, "%s/.apple2.json", getenv("HOME"));
|
ASPRINTF(&prefsFile, "%s/.apple2.json", HOMEDIR);
|
||||||
}
|
}
|
||||||
assert(prefsFile);
|
assert(prefsFile);
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ void test_common_init(void) {
|
|||||||
emulator_ctors();
|
emulator_ctors();
|
||||||
|
|
||||||
char *envvar = NULL;
|
char *envvar = NULL;
|
||||||
ASPRINTF(&envvar, "APPLE2IX_JSON=%s/.apple2.test.json", getenv("HOME"));
|
ASPRINTF(&envvar, "APPLE2IX_JSON=%s/.apple2.test.json", HOMEDIR);
|
||||||
assert(envvar);
|
assert(envvar);
|
||||||
putenv(envvar);
|
putenv(envvar);
|
||||||
LEAK(envvar);
|
LEAK(envvar);
|
||||||
|
@ -23,12 +23,6 @@
|
|||||||
# include "test/sha1.h"
|
# include "test/sha1.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ANDROID
|
|
||||||
# define HOMEDIR data_dir
|
|
||||||
#else
|
|
||||||
# define HOMEDIR getenv("HOME")
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TEST_FINISHED 0xff
|
#define TEST_FINISHED 0xff
|
||||||
#define MIXSWITCH_ADDR 0x1f32 // PEEK(7986) -- NOTE : value is hardcoded in various places
|
#define MIXSWITCH_ADDR 0x1f32 // PEEK(7986) -- NOTE : value is hardcoded in various places
|
||||||
#define WATCHPOINT_ADDR 0x1f33 // PEEK(7987) -- NOTE : value is hardcoded in various places
|
#define WATCHPOINT_ADDR 0x1f33 // PEEK(7987) -- NOTE : value is hardcoded in various places
|
||||||
|
@ -272,7 +272,7 @@ TEST test_json_serialization() {
|
|||||||
ASSERT(tokCount > 0);
|
ASSERT(tokCount > 0);
|
||||||
|
|
||||||
char *tmpFile = NULL;
|
char *tmpFile = NULL;
|
||||||
ASPRINTF(&tmpFile, "%s/json-XXXXXX", getenv("HOME"));
|
ASPRINTF(&tmpFile, "%s/json-XXXXXX", HOMEDIR);
|
||||||
ASSERT(tmpFile);
|
ASSERT(tmpFile);
|
||||||
int fd = mkstemp(tmpFile);
|
int fd = mkstemp(tmpFile);
|
||||||
ASSERT(fd > 0);
|
ASSERT(fd > 0);
|
||||||
@ -304,7 +304,7 @@ TEST test_json_serialization_pretty() {
|
|||||||
ASSERT(parsedData);
|
ASSERT(parsedData);
|
||||||
|
|
||||||
char *tmpFile = NULL;
|
char *tmpFile = NULL;
|
||||||
ASPRINTF(&tmpFile, "%s/json-pretty-XXXXXX", getenv("HOME"));
|
ASPRINTF(&tmpFile, "%s/json-pretty-XXXXXX", HOMEDIR);
|
||||||
ASSERT(tmpFile);
|
ASSERT(tmpFile);
|
||||||
int fd = mkstemp(tmpFile);
|
int fd = mkstemp(tmpFile);
|
||||||
ASSERT(fd > 0);
|
ASSERT(fd > 0);
|
||||||
@ -1896,12 +1896,12 @@ TEST test_prefs_set_props() {
|
|||||||
TEST test_prefs_load_and_save() {
|
TEST test_prefs_load_and_save() {
|
||||||
|
|
||||||
char *apple2JSON = NULL;
|
char *apple2JSON = NULL;
|
||||||
ASPRINTF(&apple2JSON, "%s/%s", getenv("HOME"), TEST_JSON);
|
ASPRINTF(&apple2JSON, "%s/%s", HOMEDIR, TEST_JSON);
|
||||||
ASSERT(apple2JSON);
|
ASSERT(apple2JSON);
|
||||||
unlink(apple2JSON);
|
unlink(apple2JSON);
|
||||||
|
|
||||||
char *apple2JSONEnv = NULL;
|
char *apple2JSONEnv = NULL;
|
||||||
ASPRINTF(&apple2JSONEnv, "APPLE2IX_JSON=%s/%s", getenv("HOME"), TEST_JSON);
|
ASPRINTF(&apple2JSONEnv, "APPLE2IX_JSON=%s/%s", HOMEDIR, TEST_JSON);
|
||||||
ASSERT(apple2JSONEnv);
|
ASSERT(apple2JSONEnv);
|
||||||
putenv(apple2JSONEnv);
|
putenv(apple2JSONEnv);
|
||||||
LEAK(apple2JSONEnv);
|
LEAK(apple2JSONEnv);
|
||||||
|
Loading…
Reference in New Issue
Block a user