Fixed potential bug in whiledir.

This commit is contained in:
Brad Arant 2024-10-14 16:02:25 -07:00
parent 2bae00acff
commit 200b8d6a43
2 changed files with 12 additions and 6 deletions

View File

@ -17,17 +17,23 @@ namespace jet {
entries.push_back(entry); entries.push_back(entry);
std::sort(entries.begin(), entries.end(), [](const auto &a, const auto &b) { return a.path() < b.path(); }); std::sort(entries.begin(), entries.end(), [](const auto &a, const auto &b) { return a.path() < b.path(); });
for(const auto &entry : entries) { for(const auto &entry : entries) {
global.variables[variables["fullpath"]] = entry.path(); if(variableDefined("fullpath"))
global.variables[variables["filename"]] = entry.path().filename(); global.variables[variables["fullpath"]] = entry.path();
global.variables[variables["filenamenoextension"]] = entry.path().stem(); if(variableDefined("filename"))
global.variables[variables["filename"]] = entry.path().filename();
if(variableDefined("filenamenoextension"))
global.variables[variables["filenamenoextension"]] = entry.path().stem();
processContainer(container); processContainer(container);
container.reset(); container.reset();
} }
} else { } else {
for(auto const &entry : std::filesystem::directory_iterator(variables["path"].str())) { for(auto const &entry : std::filesystem::directory_iterator(variables["path"].str())) {
global.variables[variables["fullpath"]] = entry.path(); if(variableDefined("fullpath"))
global.variables[variables["filename"]] = entry.path().filename(); global.variables[variables["fullpath"]] = entry.path();
global.variables[variables["filenamenoextension"]] = entry.path().stem(); if(variableDefined("filename"))
global.variables[variables["filename"]] = entry.path().filename();
if(variableDefined("filenamenoextension"))
global.variables[variables["filenamenoextension"]] = entry.path().stem();
processContainer(container); processContainer(container);
container.reset(); container.reset();
} }

BIN
jet-2.0

Binary file not shown.