44#include < cstdio>
55#include < cstdlib>
66
7- #ifdef _WIN32
8- #include < windows.h>
9- #endif
10-
117namespace ultra {
128namespace gui {
139
1410inline void startupTrace (const char * component, const char * phase) {
1511#ifdef _WIN32
16- static char g_trace_path[MAX_PATH ] = {0 };
12+ static char g_trace_path[1024 ] = {0 };
1713 static bool g_path_initialized = false ;
1814
1915 if (!g_path_initialized) {
2016 const char * env_path = std::getenv (" ULTRA_STARTUP_LOG" );
2117 if (env_path && env_path[0 ] != ' \0 ' ) {
2218 std::snprintf (g_trace_path, sizeof (g_trace_path), " %s" , env_path);
2319 } else {
24- char temp_path[MAX_PATH] = {0 };
25- DWORD n = GetTempPathA (static_cast <DWORD>(sizeof (temp_path)), temp_path);
26- if (n > 0 && n < sizeof (temp_path)) {
27- char dir_path[MAX_PATH] = {0 };
28- std::snprintf (dir_path, sizeof (dir_path), " %sProjectUltra" , temp_path);
29- CreateDirectoryA (dir_path, nullptr );
30- std::snprintf (g_trace_path, sizeof (g_trace_path), " %s\\ startup.log" , dir_path);
31- } else {
32- std::snprintf (g_trace_path, sizeof (g_trace_path), " startup.log" );
33- }
20+ std::snprintf (g_trace_path, sizeof (g_trace_path), " startup_trace.log" );
3421 }
3522 g_path_initialized = true ;
3623 }
@@ -40,7 +27,8 @@ inline void startupTrace(const char* component, const char* phase) {
4027 }
4128
4229 if (FILE* f = std::fopen (g_trace_path, " a" )) {
43- unsigned long long t = static_cast <unsigned long long >(GetTickCount64 ());
30+ static uint64_t seq = 0 ;
31+ unsigned long long t = static_cast <unsigned long long >(++seq);
4432 std::fprintf (f, " [%llu][STARTUP][%s] %s\n " ,
4533 t,
4634 component ? component : " <unknown>" ,
0 commit comments