polserver/pol-core/poltool/baredistro.cpp
turleypol 1463b76c7c
Includes are now all relative to pol-core basefolder (#906)
* all except pol

* pol and includes under defines

* something weird has happened

* remove own folder from include searchpath

* fixed remaining, adapted include style for external headers

* missing include
2026-07-25 23:01:18 +02:00

42 lines
978 B
C++

#include "poltool/baredistro.h"
#include "clib/logfacility.h"
#include <fstream>
#include <utility>
namespace Pol::PolTool
{
BareDistro::BareDistro( fs::path basedir, bool hsa, int maxtiles, int width, int height )
: _basedir( std::move( basedir ) ),
_hsa( hsa ),
_maxtiles( maxtiles ),
_width( width ),
_height( height )
{
}
void BareDistro::generate()
{
INFO_PRINTLN( "Generating minimal distro files" );
std::map<fs::path, std::vector<std::string>> distro;
distro_files( distro );
for ( const auto& file : distro )
{
fs::path relpath = _basedir / file.first;
fs::path basedir = relpath;
if ( basedir.has_filename() )
basedir.remove_filename();
if ( !fs::exists( basedir ) )
fs::create_directories( basedir );
std::ofstream ofile( relpath, std::ofstream::out );
for ( const auto& line : file.second )
{
ofile << line << "\n";
}
ofile.close();
}
}
} // namespace Pol::PolTool