From 8897841258788fa3fc7e73d5eeaad207206f5705 Mon Sep 17 00:00:00 2001 From: bmy <2583236812@qq.com> Date: Tue, 4 Jun 2024 12:12:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AE=BE=E7=BD=AE=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E8=AF=BB=E5=8F=96=E4=BA=8C=E8=BF=9B=E5=88=B6=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=8B=E7=9B=AE=E5=BD=95=E7=9A=84=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 3 +++ main.cc | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2465a58..3893be5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,9 @@ find_package(OpenCV REQUIRED) set(ZMQ zmq) set(PTHREAD pthread) +message("copy config file") +file(COPY config.toml DESTINATION ./) + message(STATUS " version: ${OpenCV_VERSION}") message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") include_directories(${OpenCV_INCLUDE_DIRS}) diff --git a/main.cc b/main.cc index 32fc534..c5b6c70 100644 --- a/main.cc +++ b/main.cc @@ -8,14 +8,19 @@ #include "tomlc99/toml.h" #include "capture.h" -#define config_file_path "../config.toml" +#define config_file_path "config.toml" int main(int argc, char **argv) { FILE *fp; char errbuf[200]; - fp = fopen(config_file_path, "r"); + char *config_path; + config_path = getcwd(NULL, 0); + sprintf(config_path, "%s/%s", config_path, config_file_path); + + log_info("load config from %s", config_path); + fp = fopen(config_path, "r"); if (!fp) { log_error("can not open conifg file");