From 35ca19c355db335d4e0f26b62823232b0b553824 Mon Sep 17 00:00:00 2001
From: Alexandr Mruchok <alexandrmruchok@gmail.com>
Date: Thu, 19 Dec 2019 03:53:08 +0000
Subject: [PATCH] feature 2648

---
 sources/cellframe_node.h | 6 ------
 sources/dap_defines.h    | 8 ++++++++
 sources/main.c           | 3 ++-
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/sources/cellframe_node.h b/sources/cellframe_node.h
index 87c418f7c..ecdc3961b 100644
--- a/sources/cellframe_node.h
+++ b/sources/cellframe_node.h
@@ -5,16 +5,10 @@
  extern "C" {
 #endif
 
-#ifdef __ANDROID__
-
-#define LOG_PATH
-
 int cellframe_node_Main(int argc, const char **argv);
 int cellframe_node__cli_Main(int argc, const char *argv[]);
 int cellframe_node_tool_Main(int argc, const char **argv);
 
-#endif
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/sources/dap_defines.h b/sources/dap_defines.h
index 5867d4010..2cdb23fc2 100644
--- a/sources/dap_defines.h
+++ b/sources/dap_defines.h
@@ -1,10 +1,17 @@
 #pragma once
+
+#define NODE_NETNAME "cellframe"
 #define DAP_APP_NAME NODE_NETNAME "-node"
 
 //#ifdef _WIN32
 //  #define SYSTEM_PREFIX "%USERPROFILE%/opt/"DAP_APP_NAME
 //#else
+#ifdef __ANDROID__
+    #define ANDROID_STORAGE_PATH "/storage/emulated/0"
+    #define SYSTEM_PREFIX ANDROID_STORAGE_PATH "/opt/" DAP_APP_NAME
+#else
   #define SYSTEM_PREFIX "/opt/" DAP_APP_NAME
+#endif
 //  #define SYSTEM_PREFIX "opt/"DAP_APP_NAME
 //#endif
 
@@ -13,6 +20,7 @@
 #define SYSTEM_CONFIGS_DIR SYSTEM_PREFIX"/etc"
 #define LOCAL_CONFIGS_DIR LOCAL_PREFIX"/etc"
 #define SYSTEM_LOGS_DIR SYSTEM_PREFIX"/var/log"
+#define SYSTEM_LOGS_PATH SYSTEM_LOGS_DIR "/" DAP_APP_NAME ".log"
 
 #define SYSTEM_CONFIG_GLOBAL_FILENAME SYSTEM_PREFIX"/etc/" DAP_APP_NAME".cfg"
 #define LOCAL_CONFIG_GLOBAL LOCAL_PREFIX"/etc/" DAP_APP_NAME".cfg"
diff --git a/sources/main.c b/sources/main.c
index 2bcdecfc6..dd9b5cc78 100755
--- a/sources/main.c
+++ b/sources/main.c
@@ -157,7 +157,8 @@ int main( int argc, const char **argv )
         memcpy(l_log_file_path, s_sys_dir_path, l_sys_dir_path_len);
         memcpy(s_pid_file_path, s_sys_dir_path, l_sys_dir_path_len);
 #endif
-        dap_snprintf( l_log_file_path + l_sys_dir_path_len , sizeof ( l_log_file_path ), "%s/%s.log", SYSTEM_LOGS_DIR , DAP_APP_NAME );
+        dap_snprintf( l_log_file_path + l_sys_dir_path_len , sizeof ( l_log_file_path ), "%s", SYSTEM_LOGS_PATH );
+
         dap_mkdir_with_parents( SYSTEM_LOGS_DIR );
 
         if ( dap_common_init( DAP_APP_NAME, l_log_file_path ) != 0 ) {
-- 
GitLab