Fixed potential bug in whiledir.

This commit is contained in:
Brad Arant committed 2024-10-14 16:02:25 -07:00
1 parent 2bae00acff
commit 200b8d6a43
2 files changed
+6

No files matched your search

+6
View File
@@ -17,16 +17,22 @@ 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) {
if(variableDefined("fullpath"))
global.variables[variables["fullpath"]] = entry.path(); global.variables[variables["fullpath"]] = entry.path();
if(variableDefined("filename"))
global.variables[variables["filename"]] = entry.path().filename(); global.variables[variables["filename"]] = entry.path().filename();
if(variableDefined("filenamenoextension"))
global.variables[variables["filenamenoextension"]] = entry.path().stem(); 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())) {
if(variableDefined("fullpath"))
global.variables[variables["fullpath"]] = entry.path(); global.variables[variables["fullpath"]] = entry.path();
if(variableDefined("filename"))
global.variables[variables["filename"]] = entry.path().filename(); global.variables[variables["filename"]] = entry.path().filename();
if(variableDefined("filenamenoextension"))
global.variables[variables["filenamenoextension"]] = entry.path().stem(); global.variables[variables["filenamenoextension"]] = entry.path().stem();
processContainer(container); processContainer(container);
container.reset(); container.reset();
BIN
View File
Binary file not shown.