From 227aca875f597e5b0ca93abb5ee9c6063b52c95d Mon Sep 17 00:00:00 2001
From: Constantin Papizh <p.const@bk.ru>
Date: Mon, 30 Dec 2019 17:56:56 +0300
Subject: [PATCH] For future use: unicode paths

---
 include/dap_common.h |  1 +
 src/dap_common.c     | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/include/dap_common.h b/include/dap_common.h
index b88fdca..a441852 100755
--- a/include/dap_common.h
+++ b/include/dap_common.h
@@ -335,6 +335,7 @@ extern size_t g_sys_dir_path_len;
 
 //int dap_common_init( const char * a_log_file );
 int dap_common_init( const char *console_title, const char *a_log_file );
+int wdap_common_init( const char *console_title, const wchar_t *a_wlog_file);
 
 void dap_common_deinit(void);
 
diff --git a/src/dap_common.c b/src/dap_common.c
index f827215..0f7704e 100755
--- a/src/dap_common.c
+++ b/src/dap_common.c
@@ -243,6 +243,28 @@ int dap_common_init( const char *a_console_title, const char *a_log_filename ) {
     return 0;
 }
 
+int wdap_common_init( const char *a_console_title, const wchar_t *a_log_filename ) {
+
+    // init randomer
+    srand( (unsigned int)time(NULL) );
+    (void) a_console_title;
+    strncpy( s_log_tag_fmt_str, "[%s]\t",sizeof (s_log_tag_fmt_str));
+    for (int i = 0; i < 16; ++i)
+            s_ansi_seq_color_len[i] =(unsigned int) strlen(s_ansi_seq_color[i]);
+    if ( a_log_filename ) {
+        s_log_file = _wfopen( a_log_filename , L"a" );
+        if( s_log_file == NULL)
+            s_log_file = _wfopen( a_log_filename , L"w" );
+        if ( s_log_file == NULL ) {
+            dap_fprintf( stderr, "Can't open log file %s to append\n", a_log_filename );
+            return -1;
+        }
+        //dap_stpcpy(s_log_file_path, a_log_filename);
+    }
+    pthread_create( &s_log_thread, NULL, s_log_thread_proc, NULL );
+    return 0;
+}
+
 /**
  * @brief dap_common_deinit Deinitialise
  */
-- 
GitLab