MCPcopy Create free account
hub / github.com/KLayout/klayout / sync_files

Method sync_files

src/lay/lay/layLibraryController.cc:140–302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140void
141LibraryController::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 }

Callers

nothing calls this directly

Calls 15

verbosityFunction · 0.85
get_envFunction · 0.85
combine_pathFunction · 0.85
is_readableFunction · 0.85
to_qstringFunction · 0.85
saltMethod · 0.80
end_flatMethod · 0.80
base_pathMethod · 0.80
add_fileMethod · 0.80
msgMethod · 0.80
lib_by_nameMethod · 0.80
libMethod · 0.80

Tested by

no test coverage detected