30#include <wx/filedlg.h>
47 if( !projFileName.FileExists() )
66 wxFileDialog zipfiledlg(
this,
_(
"Unzip Project" ), fn.GetPath(),
68 wxFD_OPEN | wxFD_FILE_MUST_EXIST );
70 if( zipfiledlg.ShowModal() == wxID_CANCEL )
73 wxString msg = wxString::Format(
_(
"\nOpen '%s'\n" ), zipfiledlg.GetPath() );
76 wxDirDialog dirDlg(
this,
_(
"Target Directory" ), fn.GetPath(), wxDD_DEFAULT_STYLE );
78 if( dirDlg.ShowModal() == wxID_CANCEL )
81 wxString unzipDir = dirDlg.GetPath() + wxT(
"/" );
82 msg.Printf(
_(
"Unzipping project in '%s'.\n" ), unzipDir );
85 if( unzipDir ==
Prj().GetProjectPath() )
87 if( !
Kiway().PlayersClose(
false ) )
95 if( unzipDir ==
Prj().GetProjectPath() )
115 wxFileDialog dlg(
this,
_(
"Archive Project Files" ),
116 fileName.GetPath(), fileName.GetFullName(),
119 if( dlg.ShowModal() == wxID_CANCEL )
122 wxFileName zipFile = dlg.GetPath();
124 wxString currdirname = fileName.GetPathWithSep();
125 wxDir dir( currdirname );
127 if( !dir.IsOpened() )
133 archiver.
Archive( currdirname, zipFile.GetFullPath(), reporter,
true,
true );
SETTINGS_MANAGER * GetSettingsManager() const
void PrintMsg(const wxString &text)
void ClearFileHistory(FILE_HISTORY *aFileHistory=nullptr)
Removes all files from the file history.
wxString GetFileFromHistory(int cmdId, const wxString &type, FILE_HISTORY *aFileHistory=nullptr)
Fetches the file name from the file history list.
void OnUnarchiveFiles(wxCommandEvent &event)
const wxString GetProjectFileName() const
void LoadProject(const wxFileName &aProjectFileName)
void OnFileHistory(wxCommandEvent &event)
void OnArchiveFiles(wxCommandEvent &event)
void OnClearFileHistory(wxCommandEvent &aEvent)
void RefreshProjectTree()
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
static bool Archive(const wxString &aSrcDir, const wxString &aDestFile, REPORTER &aReporter, bool aVerbose=true, bool aIncludeExtraFiles=false)
Creates an archive of the project.
static bool Unarchive(const wxString &aSrcFile, const wxString &aDestDir, REPORTER &aReporter)
Extracts an archive of the current project over existing files Warning: this will overwrite files in ...
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
bool LoadProject(const wxString &aFullPath, bool aSetActive=true)
Loads a project or sets up a new project with a specified path.
bool UnloadProject(PROJECT *aProject, bool aSave=true)
Saves, unloads and unregisters the given PROJECT.
A wrapper for reporting to a specific text location in a statusbar.
This file is part of the common library.
static const std::string ArchiveFileExtension
static wxString ZipFileWildcard()
Definition of file extensions used in Kicad.