| 138 | } |
| 139 | |
| 140 | void |
| 141 | LibraryController::sync_files (bool always) |
| 142 | { |
| 143 | if (tl::verbosity () >= 20) { |
| 144 | if (always) { |
| 145 | tl::info << tl::to_string (tr ("Synchronize library files unconditionally")); |
| 146 | } else { |
| 147 | tl::info << tl::to_string (tr ("Synchronize library files")); |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | m_sync_once = false; |
| 152 | |
| 153 | if (m_file_watcher) { |
| 154 | m_file_watcher->clear (); |
| 155 | m_file_watcher->enable (false); |
| 156 | } |
| 157 | |
| 158 | std::map<std::string, LibInfo> new_lib_files; |
| 159 | |
| 160 | // build a list of paths vs. technology |
| 161 | std::vector<std::pair<std::string, std::string> > paths; |
| 162 | |
| 163 | std::vector<std::string> klayout_path = lay::ApplicationBase::instance ()->klayout_path (); |
| 164 | for (std::vector<std::string>::const_iterator p = klayout_path.begin (); p != klayout_path.end (); ++p) { |
| 165 | paths.push_back (std::make_pair (*p, std::string ())); |
| 166 | } |
| 167 | |
| 168 | // add the salt grains as potential sources for library definitions |
| 169 | |
| 170 | lay::SaltController *sc = lay::SaltController::instance (); |
| 171 | if (sc) { |
| 172 | for (lay::Salt::flat_iterator g = sc->salt ().begin_flat (); g != sc->salt ().end_flat (); ++g) { |
| 173 | paths.push_back (std::make_pair ((*g)->path (), std::string ())); |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | // add the technologies as potential sources for library definitions |
| 178 | |
| 179 | for (db::Technologies::iterator t = db::Technologies::instance ()->begin (); t != db::Technologies::instance ()->end (); ++t) { |
| 180 | if (! t->base_path ().empty ()) { |
| 181 | paths.push_back (std::make_pair (t->base_path (), t->name ())); |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | // scan for library definition files |
| 186 | |
| 187 | std::string lib_file = tl::get_env ("KLAYOUT_LIB"); |
| 188 | |
| 189 | std::vector <std::pair<std::string, std::string> > lib_files; |
| 190 | |
| 191 | if (lib_file.empty ()) { |
| 192 | for (std::vector <std::pair<std::string, std::string> >::const_iterator p = paths.begin (); p != paths.end (); ++p) { |
| 193 | std::string lf = tl::combine_path (p->first, "klayout.lib"); |
| 194 | if (tl::is_readable (lf)) { |
| 195 | lib_files.push_back (std::make_pair (lf, p->second)); |
| 196 | } |
| 197 | } |
nothing calls this directly
no test coverage detected