summaryrefslogtreecommitdiff
path: root/src/repl/repl.c
diff options
context:
space:
mode:
authoriryuken <eshwarsajja20@gmail.com>2026-01-26 00:59:44 +0530
committerGitHub <noreply@github.com>2026-01-26 00:59:44 +0530
commit5066e09fcac1a679d30afb89af1385352e9b5c60 (patch)
treea4d564cbd7707a1c565135d630157b74b742f0a3 /src/repl/repl.c
parenta2804ffe502ec31fc3bf561b7e59c25622b15e19 (diff)
parent555141e35166c7f7d98c16f6f95fde8e57a651c2 (diff)
Merge branch 'z-libs:main' into main
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");