From 58cecb646744bfca69d3df7af37de2fc3bc8ab40 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Fri, 29 May 2020 23:37:53 -0400 Subject: [PATCH] Don't generate __pycache__.pak. --- Sources/Plasma/Apps/plPythonPack/main.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Sources/Plasma/Apps/plPythonPack/main.cpp b/Sources/Plasma/Apps/plPythonPack/main.cpp index 83e084d8d7..4aa402f571 100644 --- a/Sources/Plasma/Apps/plPythonPack/main.cpp +++ b/Sources/Plasma/Apps/plPythonPack/main.cpp @@ -49,10 +49,18 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include #include +#include static const char* kPackFileName = "python.pak"; static const char* kModuleFile = "__init__.py"; +/** Directories that should not generate their own .pak file. */ +static const std::unordered_set s_ignoreSubdirs{ + ST_LITERAL("plasma"), + ST_LITERAL("system"), + ST_LITERAL("__pycache__"), +}; + #if HS_BUILD_FOR_WIN32 #define NULL_DEVICE "NUL:" #else @@ -216,7 +224,7 @@ void FindSubDirs(std::vector &dirnames, const plFileName &path) std::vector subdirs = plFileSystem::ListSubdirs(path); for (auto iter = subdirs.begin(); iter != subdirs.end(); ++iter) { ST::string name = iter->GetFileName(); - if (name.compare_i("system") != 0 && name.compare_i("plasma") != 0) + if (s_ignoreSubdirs.find(name) == s_ignoreSubdirs.end()) dirnames.push_back(name); } }