Skip to content

Commit

Permalink
tempdir: Use string::compare instead of find
Browse files Browse the repository at this point in the history
  • Loading branch information
ahodesuka committed Apr 13, 2021
1 parent 0e63a48 commit c7daf37
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/tempdir.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ namespace AhoViewer

for (auto&& dir : Glib::Dir(Glib::get_tmp_dir()))
{
std::string filename{ PACKAGE "." };
// 7 = strlen(".XXXXXX")
if (dir.find(PACKAGE ".") != std::string::npos && dir.length() == strlen(PACKAGE) + 7)
if (dir.compare(0, filename.length(), filename) == 0 &&
dir.length() == filename.length() + 7)
remove_dir(Glib::build_filename(tmp_path, dir));
}

Expand Down

0 comments on commit c7daf37

Please sign in to comment.