From 9b77dbe2620874840de73f385dce0b081199e399 Mon Sep 17 00:00:00 2001 From: evan yeung Date: Wed, 4 Jan 2017 01:56:27 +0000 Subject: [PATCH] Let the love.filesystem loader support the template path for multiple interrogation mark. --- src/modules/filesystem/wrap_Filesystem.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/modules/filesystem/wrap_Filesystem.cpp b/src/modules/filesystem/wrap_Filesystem.cpp index a1e0b1773..21794ab73 100644 --- a/src/modules/filesystem/wrap_Filesystem.cpp +++ b/src/modules/filesystem/wrap_Filesystem.cpp @@ -631,8 +631,18 @@ int loader(lua_State *L) auto *inst = instance(); for (std::string element : inst->getRequirePath()) { - size_t pos = element.find('?'); - if (pos != std::string::npos) + // [Modified: 20170104] @evanyeung + // Remark: For each template, the searcher will change + // the first interrogation mark in the template by the file name. + // size_t pos = element.find('?'); + // if (pos != std::string::npos) + // element.replace(pos, 1, modulename); + + // [Modified: 20170104] @evanyeung + // Remark: For each template, the searcher will change + // each interrogation mark in the template by filename. + size_t pos = 0; + while ((pos = element.find('?', pos)) != std::string::npos) element.replace(pos, 1, modulename); if (inst->isFile(element.c_str()))