Skip to content

Commit

Permalink
fix(glog): replace deprecated API
Browse files Browse the repository at this point in the history
  • Loading branch information
lotem committed Feb 25, 2024
1 parent ab5d1d2 commit 20fdcc1
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/rime/lever/deployment_tasks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -628,14 +628,15 @@ bool CleanOldLogFiles::Run(Deployer* deployer) {
string today(ymd);
DLOG(INFO) << "today: " << today;

// Make sure we have sufficient permissions on the scanned directories.
// E.g. on Android, there's no write permission on the cwd.
vector<string> 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);
for (auto& dir : google::GetLoggingDirectories()) {
auto perms = fs::status(dir).permissions();
if ((perms & (fs::perms::owner_write | fs::perms::group_write |
fs::perms::others_write)) != fs::perms::none) {
dirs.push_back(dir);
}
}
DLOG(INFO) << "scanning " << dirs.size() << " temp directory for log files.";

Expand Down

0 comments on commit 20fdcc1

Please sign in to comment.