Skip to content

Commit

Permalink
avoid deleting non-log file or not log files of current app
Browse files Browse the repository at this point in the history
  • Loading branch information
fxliang committed Mar 6, 2024
1 parent d71b6ee commit d7eefbf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/rime/lever/deployment_tasks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -639,12 +639,14 @@ bool CleanOldLogFiles::Run(Deployer* deployer) {
continue;
vector<path> files;
DLOG(INFO) << "temp directory: " << dir;
string app_name = deployer->distribution_name;
try {
// preparing files
for (const auto& entry : fs::directory_iterator(dir)) {
const string& file_name(entry.path().filename().string());
if (entry.is_regular_file() && !entry.is_symlink() &&
boost::starts_with(file_name, "rime.") &&
boost::starts_with(file_name, app_name) &&
boost::ends_with(file_name, ".log") &&
!boost::contains(file_name, today)) {
files.push_back(entry.path());
}
Expand Down

0 comments on commit d7eefbf

Please sign in to comment.