23#include <wx/wfstream.h>
24#include <wx/zipstrm.h>
48 const std::vector<wxString>& aPathsWithOverwriteDisallowed,
49 const std::vector<JOB_OUTPUT>& aOutputsToHandle,
50 std::optional<wxString>& aResolvedOutputPath )
53 aResolvedOutputPath.reset();
58 if( outputPath.StartsWith(
"~" ) )
59 outputPath.Replace(
"~", wxGetHomeDir(),
false );
63 wxFFileOutputStream ostream( outputPath );
67 aResolvedOutputPath.reset();
73 if( FILE* fp = ostream.GetFile()->fp() )
76 wxZipOutputStream zipstream( ostream, -1, wxConvUTF8 );
82 if( !zipstream.Close() )
86 aResolvedOutputPath = outputPath;
88 aResolvedOutputPath.reset();
110 return _(
"Archive" );
bool OutputPrecheck() override
Checks if the output process can proceed before doing anything else This can include user prompts.
void FromJson(const nlohmann::json &j) override
void ToJson(nlohmann::json &j) const override
wxString GetDefaultDescription() const override
bool HandleOutputs(const wxString &aBaseTempPath, PROJECT *aProject, const std::vector< wxString > &aPathsWithOverwriteDisallowed, const std::vector< JOB_OUTPUT > &aOutputsToHandle, std::optional< wxString > &aResolvedOutputPath) override
Container for project specific data.
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject)
Replace any environment variable & text variable references with their values.
wxString EnsureFileExtension(const wxString &aFilename, const wxString &aExtension)
It's annoying to throw up nag dialogs when the extension isn't right.
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject, int aFlags)
bool AddDirectoryToZip(wxZipOutputStream &aZip, const wxString &aSourceDir, wxString &aErrors, const wxString &aParentDir)
Add a directory and its contents to a zip file.
static const std::string ArchiveFileExtension
Definition of file extensions used in Kicad.