summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorkyab <[email protected]>2013-07-18 18:15:05 +0900
committerkyab <[email protected]>2013-07-18 18:15:05 +0900
commit1fe65b2522fb480a5c70a2ac5925c223efd9c492 (patch)
tree44db1661288d8314838dfd3ebbf55b7d46a97696
parent4306fe798fc92e3a59c1dd3b020f6131c2e80ab4 (diff)
downloadmruby-1fe65b2522fb480a5c70a2ac5925c223efd9c492.tar.gz
mruby-1fe65b2522fb480a5c70a2ac5925c223efd9c492.zip
Use env[USERPROFILE] for Windows
-rw-r--r--mrbgems/mruby-bin-mirb/tools/mirb/mirb.c8
1 files changed, 7 insertions, 1 deletions
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);