1 //------------------------------------------------------------------------------ 2 // emInstallInfo.h 3 // 4 // Copyright (C) 2006-2008,2010-2011 Oliver Hamann. 5 // 6 // Homepage: http://eaglemode.sourceforge.net/ 7 // 8 // This program is free software: you can redistribute it and/or modify it under 9 // the terms of the GNU General Public License version 3 as published by the 10 // Free Software Foundation. 11 // 12 // This program is distributed in the hope that it will be useful, but WITHOUT 13 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 // FOR A PARTICULAR PURPOSE. See the GNU General Public License version 3 for 15 // more details. 16 // 17 // You should have received a copy of the GNU General Public License version 3 18 // along with this program. If not, see <http://www.gnu.org/licenses/>. 19 //------------------------------------------------------------------------------ 20 21 #ifndef emInstallInfo_h 22 #define emInstallInfo_h 23 24 #ifndef emStd2_h 25 #include <emCore/emStd2.h> 26 #endif 27 28 class emContext; 29 30 31 //============================================================================== 32 //=========================== Install info functions =========================== 33 //============================================================================== 34 35 enum emInstallDirType { 36 EM_IDT_BIN = 0, 37 EM_IDT_INCLUDE = 1, 38 EM_IDT_LIB = 2, 39 EM_IDT_HTML_DOC = 3, 40 EM_IDT_PS_DOC = 4, 41 EM_IDT_USER_CONFIG= 5, 42 EM_IDT_HOST_CONFIG= 6, 43 EM_IDT_TMP = 7, 44 EM_IDT_RES = 8, 45 EM_IDT_HOME = 9, 46 EM_NUMBER_OF_IDTS =10 47 }; 48 49 emString emGetInstallPath(emInstallDirType idt, const char * prj, 50 const char * subPath=NULL); 51 // Get the installation path of a file or directory. 52 // Arguments: 53 // idt - Type of installation directory. 54 // prj - Name of the sub-project. Currently this is ignored for 55 // some install dir types, but that could change in the 56 // future, so please always set prj best possible. 57 // subPath - A sub-path to be appended, or NULL. 58 // Returns: The installation path. 59 // 60 // The following table should make things clearer: 61 // 62 // Install Dir Type | Current Implementation | A Future Example 63 // -------------------+------------------------+------------------------ 64 // EM_IDT_BIN | <em>/bin | /usr/bin 65 // EM_IDT_INCLUDE | <em>/include/<prj> | /usr/include/<prj> 66 // EM_IDT_LIB | <em>/lib | /usr/lib 67 // EM_IDT_HTML_DOC | <em>/doc/html | /usr/share/doc/em/<prj>/html 68 // EM_IDT_PS_DOC | <em>/doc/ps | /usr/share/doc/em/<prj>/ps 69 // EM_IDT_USER_CONFIG | <home>/.eaglemode/<prj>| <home>/.em/<prj> 70 // EM_IDT_HOST_CONFIG | <em>/etc/<prj> | /etc/em/<prj> 71 // EM_IDT_TMP | $TMPDIR or /tmp | $TMPDIR or /tmp 72 // EM_IDT_RES | <em>/res/<prj> | /usr/share/emRes/<prj> 73 // EM_IDT_HOME | <home> | <home> 74 // Hint: The implementation for Windows is a little bit different. 75 76 77 emString emGetConfigDirOverloadable(emContext & context, const char * prj, 78 const char * subDir=NULL); 79 // This method returns either 80 // emGetInstallPath(EM_IDT_HOST_CONFIG,prj,subDir) 81 // or 82 // emGetInstallPath(EM_IDT_USER_CONFIG,prj,subDir) 83 // Idea is that the user can make a copy of a directory from host config 84 // to user config in order to manipulate it there. But if that copy gets 85 // outdated through an update of the other, it should no longer be used 86 // and the user should be warned. Therefore, both directories must 87 // contain a file named "version" which contains an integer version 88 // number. The user directory is returned only if the versions are 89 // equal, otherwise the host directory is returned. In addition, a 90 // warning is shown to the user if the user directory exists and if its 91 // version differs or cannot be read. The warning is made through a 92 // dialog if an emScreen can be found in the given context (or higher), 93 // otherwise the warning is reported through emWarning. If the version 94 // file of the host directory cannot be read, emFatalError is called. It 95 // is okay to call this function multiple times in a program run, 96 // because it remembers each shown warning for not showing it again, as 97 // long as the root context lives. 98 99 100 #endif 101