| 1 |
////////////////////////////////////////////////////////////////////////////// |
| 2 |
////////////////////////////////////////////////////////////////////////////// |
| 3 |
// |
| 4 |
// copyright : (C) 2014 Eran Ifrah |
| 5 |
// file name : cl_standard_paths.h |
| 6 |
// |
| 7 |
// ------------------------------------------------------------------------- |
| 8 |
// A |
| 9 |
// _____ _ _ _ _ |
| 10 |
// / __ \ | | | | (_) | |
| 11 |
// | / \/ ___ __| | ___| | _| |_ ___ |
| 12 |
// | | / _ \ / _ |/ _ \ | | | __/ _ ) |
| 13 |
// | \__/\ (_) | (_| | __/ |___| | || __/ |
| 14 |
// \____/\___/ \__,_|\___\_____/_|\__\___| |
| 15 |
// |
| 16 |
// F i l e |
| 17 |
// |
| 18 |
// This program is free software; you can redistribute it and/or modify |
| 19 |
// it under the terms of the GNU General Public License as published by |
| 20 |
// the Free Software Foundation; either version 2 of the License, or |
| 21 |
// (at your option) any later version. |
| 22 |
// |
| 23 |
////////////////////////////////////////////////////////////////////////////// |
| 24 |
////////////////////////////////////////////////////////////////////////////// |
| 25 |
|
| 26 |
#ifndef CLSTANDARDPATHS_H |
| 27 |
#define CLSTANDARDPATHS_H |
| 28 |
|
| 29 |
#include <wx/string.h> |
| 30 |
#include "codelite_exports.h" |
| 31 |
#include "cl_defs.h" |
| 32 |
|
| 33 |
class WXDLLIMPEXP_CL clStandardPaths |
| 34 |
{ |
| 35 |
private: |
| 36 |
clStandardPaths(); |
| 37 |
virtual ~clStandardPaths(); |
| 38 |
|
| 39 |
wxString m_path; |
| 40 |
wxString m_dataDir; |
| 41 |
|
| 42 |
public: |
| 43 |
static clStandardPaths& Get(); |
| 44 |
|
| 45 |
/** |
| 46 |
* @brief remove the temp directory and its content |
| 47 |
*/ |
| 48 |
void RemoveTempDir(); |
| 49 |
|
| 50 |
/** |
| 51 |
* @brief set an alternative data dir |
| 52 |
* The default data dir is set to the installation path on Windows or /usr/share/codelite on Linux systems |
| 53 |
*/ |
| 54 |
void SetDataDir(const wxString& dataDir) { this->m_dataDir = dataDir; } |
| 55 |
|
| 56 |
/** |
| 57 |
* @brief return the user local data folder. Usually this is ~/.codelite or %APPDATA%\CodeLite |
| 58 |
* However, under Linux, this function will return ~/.codelite-dbg to avoid clobbering the release config |
| 59 |
* settings |
| 60 |
*/ |
| 61 |
wxString GetUserDataDir() const; |
| 62 |
/** |
| 63 |
* @brief Sets an alternative local data folder, to be returned by GetUserDataDir() |
| 64 |
*/ |
| 65 |
void SetUserDataDir(const wxString& path); |
| 66 |
|
| 67 |
/** |
| 68 |
* @brief return the temp folder for this OS |
| 69 |
*/ |
| 70 |
wxString GetTempDir() const; |
| 71 |
|
| 72 |
/** |
| 73 |
* @brief return the path to the plugins folder |
| 74 |
*/ |
| 75 |
wxString GetPluginsDirectory() const; |
| 76 |
|
| 77 |
/** |
| 78 |
* @brief Return the location of the applications global, i.e. not user-specific, data files. |
| 79 |
* Example return values: |
| 80 |
Unix: prefix/share/appinfo |
| 81 |
Windows: the directory where the executable file is located |
| 82 |
Mac: appinfo.app/Contents/SharedSupport bundle subdirectory |
| 83 |
*/ |
| 84 |
wxString GetDataDir() const; |
| 85 |
|
| 86 |
// Under MSW, OSX and GTK the bin folder is the same directory as the |
| 87 |
// main executable (codelite{.exe}) |
| 88 |
// Typically this function returns: |
| 89 |
// MSW: /path/to/codelite.exe |
| 90 |
// GTK: /usr/bin |
| 91 |
// OSX: /path/to/codelite.app/Contents/MacOS |
| 92 |
wxString GetBinFolder() const; |
| 93 |
|
| 94 |
/** |
| 95 |
* @brief return the full path for an executable. This function |
| 96 |
* usually returns: GetBinFolder() + "/" + toolname + ".exe" |
| 97 |
* @note the .exe and "/" are platform dependant |
| 98 |
*/ |
| 99 |
wxString GetBinaryFullPath(const wxString& toolname) const; |
| 100 |
|
| 101 |
/** |
| 102 |
* @brief get CodeLite executale path |
| 103 |
*/ |
| 104 |
wxString GetExecutablePath() const; |
| 105 |
|
| 106 |
/** |
| 107 |
* @brief return the user lexers directory |
| 108 |
*/ |
| 109 |
wxString GetUserLexersDir() const; |
| 110 |
|
| 111 |
/** |
| 112 |
* @brief return the default (installation) lexers directory |
| 113 |
*/ |
| 114 |
wxString GetLexersDir() const; |
| 115 |
|
| 116 |
/** |
| 117 |
* @brief return the project templates dircectory |
| 118 |
*/ |
| 119 |
wxString GetProjectTemplatesDir() const; |
| 120 |
|
| 121 |
/** |
| 122 |
* @brief return the user templates folder |
| 123 |
* @return |
| 124 |
*/ |
| 125 |
wxString GetUserProjectTemplatesDir() const; |
| 126 |
|
| 127 |
/** |
| 128 |
* @brief return the documents directory. |
| 129 |
* Windows: C:\Users\name\Documents |
| 130 |
* Unix: /home/name/Documents |
| 131 |
* OSX: /Users/name/Documents |
| 132 |
*/ |
| 133 |
wxString GetDocumentsDir() const; |
| 134 |
|
| 135 |
/** |
| 136 |
* @brief return the installation directory. |
| 137 |
*/ |
| 138 |
wxString GetInstallDir() const; |
| 139 |
|
| 140 |
void IgnoreAppSubDir(const wxString& subdirPattern); |
| 141 |
}; |
| 142 |
|
| 143 |
#endif // CLSTANDARDPATHS_H |