summaryrefslogtreecommitdiff
path: root/src/repl/repl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/repl/repl.c')
-rw-r--r--src/repl/repl.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/repl/repl.c b/src/repl/repl.c
index 274c14c..cb63293 100644
--- a/src/repl/repl.c
+++ b/src/repl/repl.c
@@ -28,12 +28,10 @@ void run_repl(const char *self_path)
char history_path[512];
const char *home = getenv("HOME");
-#ifdef _WIN32
- if (!home)
+ if (z_is_windows() && !home)
{
home = getenv("USERPROFILE");
}
-#endif
if (home)
{
snprintf(history_path, sizeof(history_path), "%s/.zprep_history", home);
@@ -273,10 +271,14 @@ void run_repl(const char *self_path)
{
tmpdir = getenv("TMP");
}
- if (!tmpdir)
+ if (!tmpdir && !z_is_windows())
{
tmpdir = "/tmp";
}
+ if (!tmpdir)
+ {
+ tmpdir = ".";
+ }
snprintf(edit_path, sizeof(edit_path), "%s/zprep_edit_%d.zc", tmpdir, rand());
FILE *f = fopen(edit_path, "w");
if (f)
@@ -658,10 +660,14 @@ void run_repl(const char *self_path)
{
tmpdir = getenv("TMP");
}
- if (!tmpdir)
+ if (!tmpdir && !z_is_windows())
{
tmpdir = "/tmp";
}
+ if (!tmpdir)
+ {
+ tmpdir = ".";
+ }
snprintf(tmp_path, sizeof(tmp_path), "%s/zprep_repl_type_%d.zc", tmpdir,
rand());
FILE *f = fopen(tmp_path, "w");
@@ -752,10 +758,14 @@ void run_repl(const char *self_path)
{
tmpdir = getenv("TMP");
}
- if (!tmpdir)
+ if (!tmpdir && !z_is_windows())
{
tmpdir = "/tmp";
}
+ if (!tmpdir)
+ {
+ tmpdir = ".";
+ }
snprintf(tmp_path, sizeof(tmp_path), "%s/zprep_repl_time_%d.zc", tmpdir,
rand());
FILE *f = fopen(tmp_path, "w");