1 /* 2 * The contents of this file are subject to the Mozilla Public License 3 * Version 1.0 (the "License"); you may not use this file except in 4 * compliance with the License. You may obtain a copy of the License at 5 * http://www.mozilla.org/MPL/ 6 * 7 * Software distributed under the License is distributed on an "AS IS" 8 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 * License for the specific language governing rights and limitations 10 * under the License. 11 * 12 * The Initial Developer of this code is David Baum. 13 * Portions created by David Baum are Copyright (C) 1999 David Baum. 14 * All Rights Reserved. 15 * 16 * Portions created by John Hansen are Copyright (C) 2005 John Hansen. 17 * All Rights Reserved. 18 * 19 */ 20 21 #ifndef __DirList_h 22 #define __DirList_h 23 24 #ifndef __PListS_h 25 #include "PListS.h" 26 #endif 27 28 class DirList 29 { 30 public: 31 32 enum 33 { 34 kMaxPathname = 1024 35 }; 36 37 ~DirList(); 38 39 void Add(const char *dirspec); 40 bool Find(const char *filename, char *pathname); 41 42 private: 43 class Entry : public PLinkS<Entry> 44 { 45 public: 46 Entry(const char *path); 47 ~Entry(); 48 GetPath()49 const char * GetPath() const { return fPath; } 50 51 private: 52 char* fPath; 53 }; 54 55 PListS<Entry> fEntries; 56 }; 57 58 59 /* 60 * the following conditions attempt to set DIR_DELIMITER base 61 * on the intended target. They may be overridden by defining 62 * DIR_DELIMITER prior to compilation. 63 */ 64 65 #if !defined(DIR_DELIMITER) 66 #if defined(macintosh) 67 #define DIR_DELIMITER ':' 68 #elif defined(WIN32) 69 #define DIR_DELIMITER '\\' 70 #else 71 // assume unix 72 #define DIR_DELIMITER '/' 73 #endif 74 #endif 75 76 77 #endif 78