From c630a3e75711f837f39d5072c728a8b189f096a2 Mon Sep 17 00:00:00 2001 From: JGZYES Date: Thu, 3 Sep 2026 10:48:25 +0800 Subject: [PATCH] install: Linux/macOS default install dir is /usr/local/bin; only -p or PMM_INSTALL_DIR overrides (specified dir) --- src/pmm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pmm.c b/src/pmm.c index 4c23b24..b31b8fb 100644 --- a/src/pmm.c +++ b/src/pmm.c @@ -205,10 +205,16 @@ const char *pmm_cache_dir(char *buf, size_t size) { const char *pmm_install_dir(char *buf, size_t size) { const char *env = getenv("PMM_INSTALL_DIR"); if (env && *env) { snprintf(buf, size, "%s", env); } - else { + else if (g_base_path[0]) { + snprintf(buf, size, "%s", g_base_path); /* -p : flat install into the specified dir */ + } else { +#ifdef _WIN32 char base[1024]; pmm_base_dir(base, sizeof(base)); - snprintf(buf, size, "%s/bin", base); + snprintf(buf, size, "%s/bin", base); /* Windows default -> \bin */ +#else + snprintf(buf, size, "/usr/local/bin"); /* Linux/macOS default -> system-wide (on PATH) */ +#endif } mkdir_p(buf); return buf;