/
Mr.Stalin
/
FOnline-Engine
Обзор
Документация
Войти
/
Mr.Stalin
/
FOnline-Engine
Код
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Source/Tools/RawCopyBaker.cpp
102 строки
3 KB
cvet
Non const locals (#190)
24 июл 2026, 10:46
Не верифицирован
24 июл 2026, 10:46
4883d25
Код
Авторство
О чём код?
// __________ ___ ______ _ // / ____/ __ \____ / (_)___ ___ / ____/___ ____ _(_)___ ___ // / /_ / / / / __ \/ / / __ \/ _ \ / __/ / __ \/ __ `/ / __ \/ _ ` // / __/ / /_/ / / / / / / / / / __/ / /___/ / / / /_/ / / / / / __/ // /_/ \____/_/ /_/_/_/_/ /_/\___/ /_____/_/ /_/\__, /_/_/ /_/\___/ // /____/ // FOnline Engine // https://fonline.ru // https://github.com/cvet/fonline // // MIT License // // Copyright (c) 2006 - 2026, Anton Tsvetinskiy aka cvet <cvet@tut.by> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. // #include "RawCopyBaker.h" #include "Application.h" FO_BEGIN_NAMESPACE RawCopyBaker::RawCopyBaker(shared_ptr<BakingContext> ctx) : BaseBaker(std::move(ctx), NAME) { FO_STACK_TRACE_ENTRY(); } RawCopyBaker::~RawCopyBaker() { FO_STACK_TRACE_ENTRY(); } void RawCopyBaker::BakeFiles(const FileCollection& files, string_view target_path) const { FO_STACK_TRACE_ENTRY(); // Collect files vector<File> filtered_files; if (target_path.empty()) { for (const auto& file_header : files) { string ext = strex(file_header.GetPath()).get_file_extension(); auto it = std::ranges::find(_context->Settings->RawCopyFileExtensions, ext); if (it == _context->Settings->RawCopyFileExtensions.end()) { continue; } if (_context->BakeChecker && !_context->BakeChecker(file_header.GetPath(), file_header.GetWriteTime())) { continue; } filtered_files.emplace_back(File::Load(file_header)); } } else { string ext = strex(target_path).get_file_extension(); auto it = std::ranges::find(_context->Settings->RawCopyFileExtensions, ext); if (it == _context->Settings->RawCopyFileExtensions.end()) { return; } auto file = files.FindFileByPath(target_path); if (!file) { return; } if (_context->BakeChecker && !_context->BakeChecker(file.GetPath(), file.GetWriteTime())) { return; } filtered_files.emplace_back(std::move(file)); } if (filtered_files.empty()) { return; } // Process files for (const auto& file : filtered_files) { _context->WriteData(file.GetPath(), file.GetData()); } } FO_END_NAMESPACE