qBittorrent
anonymous_namespace{searchpluginmanager.cpp} Namespace Reference

Functions

void clearPythonCache (const QString &path)
 

Function Documentation

◆ clearPythonCache()

void anonymous_namespace{searchpluginmanager.cpp}::clearPythonCache ( const QString &  path)

Definition at line 55 of file searchpluginmanager.cpp.

56  {
57  // remove python cache artifacts in `path` and subdirs
58 
59  QStringList dirs = {path};
60  QDirIterator iter {path, (QDir::AllDirs | QDir::NoDotAndDotDot), QDirIterator::Subdirectories};
61  while (iter.hasNext())
62  dirs += iter.next();
63 
64  for (const QString &dir : asConst(dirs))
65  {
66  // python 3: remove "__pycache__" folders
67  if (dir.endsWith("/__pycache__"))
68  {
70  continue;
71  }
72 
73  // python 2: remove "*.pyc" files
74  const QStringList files = QDir(dir).entryList(QDir::Files);
75  for (const QString &file : files)
76  {
77  if (file.endsWith(".pyc"))
79  }
80  }
81  }
constexpr std::add_const_t< T > & asConst(T &t) noexcept
Definition: global.h:42
flag icons free of to any person obtaining a copy of this software and associated documentation files(the "Software")
void removeDirRecursive(const QString &path)
Definition: fs.cpp:187
bool forceRemove(const QString &filePath)
Definition: fs.cpp:173
file(GLOB QBT_TS_FILES "${qBittorrent_SOURCE_DIR}/src/lang/*.ts") set_source_files_properties($
Definition: CMakeLists.txt:5

References asConst(), file(), files(), Utils::Fs::forceRemove(), and Utils::Fs::removeDirRecursive().

Referenced by SearchPluginManager::installPlugin(), and SearchPluginManager::uninstallPlugin().

Here is the call graph for this function:
Here is the caller graph for this function: