00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include <stdio.h>
00028 #include <fcntl.h>
00029
00030 #include <string>
00031 #include <list>
00032
00033 using std::string;
00034
00035
00036 class Y2PathSearch
00037 {
00038
00039 public:
00040
00044 static int numberOfComponentLevels ();
00045
00051 enum WHAT { GENERIC, EXECCOMP, PLUGIN };
00052
00057 static string searchPath (WHAT what, int level);
00058
00063 static int currentComponentLevel ();
00064
00070 static string findy2 (string filename, int mode = R_OK, int level = -1);
00071
00082 static string findy2exe (string root, string compname, bool server,
00083 bool non_y2, int level);
00084
00089 static string findy2plugin (string name, int level);
00090
00092 static string globsubst (const string& where,
00093 const string& oldstr, const string& newstr);
00098 static string completeFilename (const string& fname);
00099
00100 private:
00101
00102 static int defaultComponentLevel ();
00103
00104 };
00105
00111 class YCPPathSearch : public Y2PathSearch
00112 {
00113 public:
00114 enum Kind
00115 {
00116
00117
00118 Client,
00119 Include,
00120 Module,
00121
00122 num_Kind
00123 };
00124
00128 static string find (Kind kind, const string& name);
00132 static string findInclude (const string& name);
00133
00140 static string findModule (string name, bool the_source = false);
00141
00147 static void addPath (Kind kind, const string& path);
00148
00154 static void clearPaths (Kind kind);
00155
00160 static void initialize ();
00161
00163 static std::list<string>::const_iterator searchListBegin (Kind kind);
00165 static std::list<string>::const_iterator searchListEnd (Kind kind);
00166
00174 static string bytecodeForFile (string file);
00175
00176 private:
00177 static bool initialized;
00178 static std::list<string> searchList[num_Kind];
00179 static void initialize (Kind kind, const char *suffix);
00180 };