| 1 |
#ifndef PLAFORM_COMMON_HPP |
| 2 |
#define PLAFORM_COMMON_HPP |
| 3 |
|
| 4 |
#include "codelite_exports.h" |
| 5 |
|
| 6 |
#include <vector> |
| 7 |
#include <wx/string.h> |
| 8 |
|
| 9 |
class WXDLLIMPEXP_CL PlatformCommon |
| 10 |
{ |
| 11 |
public: |
| 12 |
enum Flags { |
| 13 |
SEARCH_PATH_ENV = (1 << 0), |
| 14 |
}; |
| 15 |
|
| 16 |
protected: |
| 17 |
size_t m_flags = SEARCH_PATH_ENV; |
| 18 |
|
| 19 |
public: |
| 20 |
PlatformCommon() {} |
| 21 |
virtual ~PlatformCommon() {} |
| 22 |
|
| 23 |
public: |
| 24 |
/** |
| 25 |
* @brief some vendros deliver binaries with "-N" where N is the version number |
| 26 |
* this method attempts to search for command-<N>...command (in this order) |
| 27 |
*/ |
| 28 |
bool WhichWithVersion(const wxString& command, const std::vector<int>& versions, wxString* command_fullpath); |
| 29 |
|
| 30 |
/** |
| 31 |
* @brief locaate rustup bin folder (on platforms that this is available) |
| 32 |
*/ |
| 33 |
bool FindRustupToolchainBinDir(wxString* rustup_bin_dir); |
| 34 |
|
| 35 |
/// override this in the platform specific code |
| 36 |
virtual bool Which(const wxString& command, wxString* command_fullpath) |
| 37 |
{ |
| 38 |
wxUnusedVar(command); |
| 39 |
wxUnusedVar(command_fullpath); |
| 40 |
return false; |
| 41 |
} |
| 42 |
|
| 43 |
/** |
| 44 |
* @brief locate msys2 installation folder (e.g. C:/msys2) |
| 45 |
*/ |
| 46 |
virtual bool FindInstallDir(wxString* msyspath) |
| 47 |
{ |
| 48 |
wxUnusedVar(msyspath); |
| 49 |
return false; |
| 50 |
} |
| 51 |
|
| 52 |
/** |
| 53 |
* @brief locate the home folder within msys2 (e.g. C:/msys2/home/eran) |
| 54 |
*/ |
| 55 |
virtual bool FindHomeDir(wxString* homedir) |
| 56 |
{ |
| 57 |
wxUnusedVar(homedir); |
| 58 |
return false; |
| 59 |
} |
| 60 |
|
| 61 |
/** |
| 62 |
* @brief set the chroot folder (on linux, this method is a placeholder) |
| 63 |
*/ |
| 64 |
virtual void SetChroot(const wxString& chroot) { wxUnusedVar(chroot); } |
| 65 |
}; |
| 66 |
#endif // PLAFORM_COMMON_HPP |