You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
3.2 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2009-2014 Jerry Jacobs
  5. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.TXT for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. #ifndef GESTFICH_H
  25. #define GESTFICH_H
  26. #include <wx/filename.h>
  27. #include <wx/process.h>
  28. /**
  29. * @note Do we really need these defined?
  30. */
  31. #define UNIX_STRING_DIR_SEP wxT( "/" )
  32. #define WIN_STRING_DIR_SEP wxT( "\\" )
  33. /* Forward class declarations. */
  34. class EDA_LIST_DIALOG;
  35. /**
  36. * Run the PDF viewer and display a PDF file.
  37. *
  38. * @param file the PDF file to open.
  39. * @return true is success or false if no PDF viewer found.
  40. */
  41. bool OpenPDF( const wxString& file );
  42. void OpenFile( const wxString& file );
  43. /**
  44. * @param aSrcPath is the full filename of the source.
  45. * @param aDestPath is the full filename of the target
  46. * @param aErrors a wxString to *append* any errors to
  47. */
  48. void KiCopyFile( const wxString& aSrcPath, const wxString& aDestPath, wxString& aErrors );
  49. /**
  50. * Call the executable file \a aEditorName with the parameter \a aFileName.
  51. */
  52. int ExecuteFile( const wxString& aEditorName, const wxString& aFileName = wxEmptyString,
  53. wxProcess* aCallback = nullptr );
  54. /**
  55. * Add un " to the start and the end of string (if not already done).
  56. *
  57. * @param string string to modify.
  58. */
  59. void QuoteString( wxString& string );
  60. /**
  61. * Search the executable file shortname in KiCad binary path and return full file
  62. * name if found or shortname if the kicad binary path is kicad/bin.
  63. *
  64. * The binary path is found from:
  65. * - binary path.
  66. * - KICAD environment variable.
  67. * - c:\\kicad or /usr/local/kicad (the default).
  68. * - default binary path.
  69. */
  70. wxString FindKicadFile( const wxString& shortname );
  71. /**
  72. * Quote return value of wxFileName::GetFullPath().
  73. *
  74. * This allows file name paths with spaces to be used as parameters to ProcessExecute
  75. * function calls.
  76. *
  77. * @param fn is the filename to wrap.
  78. * @param format if provided, can be used to transform the nature of the wrapped filename
  79. * to another platform.
  80. */
  81. extern wxString QuoteFullPath( wxFileName& fn, wxPathFormat format = wxPATH_NATIVE );
  82. /**
  83. * Removes the directory \a aDirName and all its contents including
  84. * subdirectories and their files
  85. */
  86. bool RmDirRecursive( const wxString& aDirName, wxString* aErrors = nullptr );
  87. #endif /* GESTFICH_H */