From e799e79012f641f29e7ecb5a37f0b43b22ba644c Mon Sep 17 00:00:00 2001 From: Zachary Spriggs Date: Mon, 21 Jun 2021 20:25:21 -0400 Subject: [PATCH] Add %TEMP% to _DIR$() folder specifications Adds the %TEMP% directory to `_DIR$()` folder specifications. --- internal/c/libqb.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/internal/c/libqb.cpp b/internal/c/libqb.cpp index b8fbc3b45..17f1e2775 100644 --- a/internal/c/libqb.cpp +++ b/internal/c/libqb.cpp @@ -27047,6 +27047,19 @@ qbs *func__dir(qbs* context_in){ } #endif } + + if (qbs_equal(qbs_ucase(context),qbs_new_txt("TEMP"))||qbs_equal(qbs_ucase(context),qbs_new_txt("TEMP FILES"))){ + #ifdef QB64_WINDOWS + CHAR osPath[MAX_PATH+1]; + DWORD pathlen; + pathlen = GetTempPathA(261, osPath); //%TEMP% + char path[pathlen]; + memcpy(path, &osPath, pathlen); + if (pathlen > 0){ + return qbs_new_txt(path); + } + #endif + } //general fallback location #ifdef QB64_WINDOWS