Begin design of comment evaluation and {{variables}}

This commit is contained in:
Krzosa Karol
2026-01-31 09:49:44 +01:00
parent 4d9cfcd302
commit 217659256b
7 changed files with 54 additions and 13 deletions

View File

@@ -1172,3 +1172,25 @@ API void CloseStdin(Process *process) {
API double GetTimeSeconds() {
return GetTimeMicros() / 1000000.0;
}
API String WriteTempFile(String data) {
Scratch scratch;
#if OS_WINDOWS
int buffer_len = MAX_PATH+1;
char16_t *buffer = AllocArray(scratch, char16_t, buffer_len);
Assert(sizeof(char16_t) == sizeof(wchar_t));
DWORD result = GetTempPath2W(buffer_len, (LPWSTR)buffer);
Assert(result != 0);
String16 temp16 = {buffer, result};
NormalizePathInPlace(temp16);
String temp_directory = ToString(scratch, temp16);
#else
String temp_directory = "/tmp";
#endif
String temp_filename = Format(scratch, "%S/temp%llu", temp_directory, GetTimeNanos());
bool done = WriteFile(temp_filename, data);
Assert(done);
return temp_filename;
}