From 08abc300a2220161f921ad25a1d85725f1f6284a Mon Sep 17 00:00:00 2001 From: Qijia Liu Date: Mon, 9 Oct 2023 21:08:18 -0400 Subject: [PATCH] CleanOldLogFiles doesn't scan cwd when no log_dir --- src/rime/lever/deployment_tasks.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/rime/lever/deployment_tasks.cc b/src/rime/lever/deployment_tasks.cc index 6f5bf5d9f6..5d8cc48334 100644 --- a/src/rime/lever/deployment_tasks.cc +++ b/src/rime/lever/deployment_tasks.cc @@ -629,7 +629,15 @@ bool CleanOldLogFiles::Run(Deployer* deployer) { string today(ymd); DLOG(INFO) << "today: " << today; - vector dirs = google::GetLoggingDirectories(); + vector dirs; + // Don't call GetLoggingDirectories as it contains current directory, + // which causes permission issue on Android + // https://github.com/google/glog/blob/b58718f37cf58fa17f48bf1d576974d133d89839/src/logging.cc#L2410 + if (FLAGS_log_dir.empty()) { + google::GetExistingTempDirectories(&dirs); + } else { + dirs.push_back(FLAGS_log_dir); + } DLOG(INFO) << "scanning " << dirs.size() << " temp directory for log files."; int removed = 0;