KiCad PCB EDA Suite
Loading...
Searching...
No Matches
gestfich.cpp File Reference

Functions for file management. More...

#include <wx/mimetype.h>
#include <wx/filename.h>
#include <wx/dir.h>
#include <pgm_base.h>
#include <confirm.h>
#include <core/arraydim.h>
#include <gestfich.h>
#include <string_utils.h>
#include <launch_ext.h>
#include "wx/tokenzr.h"

Go to the source code of this file.

Functions

void QuoteString (wxString &string)
 Add un " to the start and the end of string (if not already done). More...
 
wxString FindKicadFile (const wxString &shortname)
 Search the executable file shortname in KiCad binary path and return full file name if found or shortname if the kicad binary path is kicad/bin. More...
 
int ExecuteFile (const wxString &aEditorName, const wxString &aFileName, wxProcess *aCallback)
 Call the executable file aEditorName with the parameter aFileName. More...
 
bool OpenPDF (const wxString &file)
 Run the PDF viewer and display a PDF file. More...
 
void OpenFile (const wxString &file)
 
void KiCopyFile (const wxString &aSrcPath, const wxString &aDestPath, wxString &aErrors)
 
wxString QuoteFullPath (wxFileName &fn, wxPathFormat format)
 Quote return value of wxFileName::GetFullPath(). More...
 

Detailed Description

Functions for file management.

Definition in file gestfich.cpp.

Function Documentation

◆ ExecuteFile()

int ExecuteFile ( const wxString &  aEditorName,
const wxString &  aFileName,
wxProcess *  aCallback 
)

◆ FindKicadFile()

wxString FindKicadFile ( const wxString &  shortname)

Search the executable file shortname in KiCad binary path and return full file name if found or shortname if the kicad binary path is kicad/bin.

The binary path is found from:

  • binary path.
  • KICAD environment variable.
  • c:\kicad or /usr/local/kicad (the default).
  • default binary path.

Definition at line 53 of file gestfich.cpp.

References arrayDim(), and Pgm().

Referenced by KICAD_MANAGER_FRAME::DoWithAcceptedFiles(), and ExecuteFile().

◆ KiCopyFile()

void KiCopyFile ( const wxString &  aSrcPath,
const wxString &  aDestPath,
wxString &  aErrors 
)
Parameters
aSrcPathis the full filename of the source.
aDestPathis the full filename of the target
aErrorsa wxString to append any errors to

Definition at line 276 of file gestfich.cpp.

References _.

Referenced by MIGRATION_TRAVERSER::OnFile(), SAVE_AS_TRAVERSER::OnFile(), SCH::IFACE::SaveFileAs(), GERBV::IFACE::SaveFileAs(), PGE::IFACE::SaveFileAs(), PCB::IFACE::SaveFileAs(), PCB_EDIT_FRAME::SavePcbCopy(), and PCB_EDIT_FRAME::SavePcbFile().

◆ OpenFile()

void OpenFile ( const wxString &  file)

Definition at line 257 of file gestfich.cpp.

Referenced by PROJECT_TREE_ITEM::Activate().

◆ OpenPDF()

bool OpenPDF ( const wxString &  file)

Run the PDF viewer and display a PDF file.

Parameters
filethe PDF file to open.
Returns
true is success or false if no PDF viewer found.

Definition at line 221 of file gestfich.cpp.

References _, DisplayError(), LaunchExternal(), and Pgm().

Referenced by PROJECT_TREE_ITEM::Activate(), and GetAssociatedDocument().

◆ QuoteFullPath()

wxString QuoteFullPath ( wxFileName &  fn,
wxPathFormat  format = wxPATH_NATIVE 
)

Quote return value of wxFileName::GetFullPath().

This allows file name paths with spaces to be used as parameters to ProcessExecute function calls.

Parameters
fnis the filename to wrap.
formatif provided, can be used to transform the nature of the wrapped filename to another platform.

Definition at line 291 of file gestfich.cpp.

◆ QuoteString()

void QuoteString ( wxString &  string)

Add un " to the start and the end of string (if not already done).

Parameters
stringstring to modify.

Definition at line 43 of file gestfich.cpp.