From 1fe65b2522fb480a5c70a2ac5925c223efd9c492 Mon Sep 17 00:00:00 2001 From: kyab Date: Thu, 18 Jul 2013 18:15:05 +0900 Subject: Use env[USERPROFILE] for Windows --- mrbgems/mruby-bin-mirb/tools/mirb/mirb.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c b/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c index 9f030c112..3111eea8f 100644 --- a/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +++ b/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c @@ -253,6 +253,7 @@ main(int argc, char **argv) int n; int code_block_open = FALSE; int ai; + char *home = NULL; /* new interpreter instance */ mrb = mrb_open(); @@ -279,7 +280,12 @@ main(int argc, char **argv) #ifdef ENABLE_READLINE using_history(); - strcpy(history_path, getenv("HOME")); + home = getenv("HOME"); +#ifdef _WIN32 + if (!home) + home = getenv("USERPROFILE"); +#endif + strcpy(history_path, home); strcat(history_path, "/"); strcat(history_path, history_file_name); read_history(history_path); -- cgit v1.2.3