18 shouldDeleteResourceLibraries =
false;
26 if (shouldDeleteResourceLibraries)
27 for (vector<string>::iterator i = resourcePathsLoaded.begin(); i != resourcePathsLoaded.end(); ++i)
40 if (find(resourcePathsLoaded.begin(), resourcePathsLoaded.end(), path) == resourcePathsLoaded.end() ||
41 find(resourcePathsToUnload.begin(), resourcePathsToUnload.end(), path) != resourcePathsToUnload.end())
43 resourcePathsToLoad.push_back(path);
44 canUnloadPathToLoad[path] = isUnloadable;
45 dependenciesToLoad[path] = dependenciesInLibrary;
54 if (find(resourcePathsLoaded.begin(), resourcePathsLoaded.end(), path) != resourcePathsLoaded.end())
56 if (! canUnloadPathLoaded[path])
58 VUserLog(
"The resource library %s can't be unloaded.", path.c_str());
62 resourcePathsToUnload.insert(path);
73 set<string> dependenciesInLibraries;
75 for (
string path : resourcePathsLoaded)
77 if (canUnloadPathLoaded[path])
79 resourcePathsToUnload.insert(path);
80 dependenciesInLibraries.insert( dependenciesLoaded[path].begin(), dependenciesLoaded[path].end() );
84 return dependenciesInLibraries;
96 if (find(cachePathsLoaded.begin(), cachePathsLoaded.end(), path) == cachePathsLoaded.end() ||
97 find(cachePathsToUnload.begin(), cachePathsToUnload.end(), path) != cachePathsToUnload.end())
99 cachePathsToLoad.push_back(path);
100 canUnloadPathToLoad[path] = isUnloadable;
101 dependenciesToLoad[path] = dependenciesInLibrary;
113 if (find(cachePathsLoaded.begin(), cachePathsLoaded.end(), path) != cachePathsLoaded.end())
115 if (! canUnloadPathLoaded[path])
117 VUserLog(
"The cache library %s can't be unloaded.", path.c_str());
121 cachePathsToUnload.insert(path);
123 else if (find(cachePathsToUnload.begin(), cachePathsToUnload.end(), path) == cachePathsToUnload.end())
128 return dependenciesLoaded[path];
136 for (map<
string, set<string> >::iterator i = dependenciesLoaded.begin(); i != dependenciesLoaded.end(); ++i)
138 if (i->second.find(dependency) != i->second.end())
140 string libraryPath = i->first;
142 if (! canUnloadPathLoaded[libraryPath])
144 VUserLog(
"The library containing %s (%s) can't be unloaded.", dependency.c_str(), libraryPath.c_str());
148 if (find(resourcePathsLoaded.begin(), resourcePathsLoaded.end(), libraryPath) != resourcePathsLoaded.end())
149 resourcePathsToUnload.insert(libraryPath);
150 if (find(cachePathsLoaded.begin(), cachePathsLoaded.end(), libraryPath) != cachePathsLoaded.end())
151 cachePathsToUnload.insert(libraryPath);
166 vector<string> libraryPathsToLoad;
168 for (vector<string>::iterator i = cachePathsLoaded.begin(); i != cachePathsLoaded.end(); ++i)
169 if (canUnloadPathLoaded[*i])
170 libraryPathsToLoad.push_back(*i);
172 libraryPathsToLoad.insert(libraryPathsToLoad.end(), cachePathsToLoad.begin(), cachePathsToLoad.end());
174 for (vector<string>::iterator i = resourcePathsLoaded.begin(); i != resourcePathsLoaded.end(); ++i)
175 if (canUnloadPathLoaded[*i])
176 libraryPathsToLoad.push_back(*i);
178 libraryPathsToLoad.insert(libraryPathsToLoad.end(), resourcePathsToLoad.begin(), resourcePathsToLoad.end());
180 resourcePathsLoaded.insert(resourcePathsLoaded.end(), resourcePathsToLoad.begin(), resourcePathsToLoad.end());
181 resourcePathsToLoad.clear();
183 cachePathsLoaded.insert(cachePathsLoaded.end(), cachePathsToLoad.begin(), cachePathsToLoad.end());
184 cachePathsToLoad.clear();
186 dependenciesLoaded.insert(dependenciesToLoad.begin(), dependenciesToLoad.end());
187 dependenciesToLoad.clear();
189 canUnloadPathLoaded.insert(canUnloadPathToLoad.begin(), canUnloadPathToLoad.end());
190 canUnloadPathToLoad.clear();
192 return libraryPathsToLoad;
204 for (set<string>::iterator i = resourcePathsToUnload.begin(); i != resourcePathsToUnload.end(); ++i)
206 dependenciesLoaded.erase(*i);
207 canUnloadPathLoaded.erase(*i);
209 if (shouldDeleteResourceLibraries)
213 for (set<string>::iterator i = cachePathsToUnload.begin(); i != cachePathsToUnload.end(); ++i)
215 dependenciesLoaded.erase(*i);
216 canUnloadPathLoaded.erase(*i);
219 for (
int i = resourcePathsLoaded.size()-1; i >= 0; --i)
220 if (find(resourcePathsToUnload.begin(), resourcePathsToUnload.end(), resourcePathsLoaded[i]) != resourcePathsToUnload.end())
221 resourcePathsLoaded.erase(resourcePathsLoaded.begin() + i);
223 for (
int i = cachePathsLoaded.size()-1; i >= 0; --i)
224 if (find(cachePathsToUnload.begin(), cachePathsToUnload.end(), cachePathsLoaded[i]) != cachePathsToUnload.end())
225 cachePathsLoaded.erase(cachePathsLoaded.begin() + i);
227 vector<string> libraryPathsToUnload;
229 libraryPathsToUnload.insert(libraryPathsToUnload.end(), resourcePathsToUnload.rbegin(), resourcePathsToUnload.rend());
231 for (vector<string>::reverse_iterator i = resourcePathsLoaded.rbegin(); i != resourcePathsLoaded.rend(); ++i)
232 if (canUnloadPathLoaded[*i])
233 libraryPathsToUnload.push_back(*i);
235 libraryPathsToUnload.insert(libraryPathsToUnload.end(), cachePathsToUnload.rbegin(), cachePathsToUnload.rend());
237 for (vector<string>::reverse_iterator i = cachePathsLoaded.rbegin(); i != cachePathsLoaded.rend(); ++i)
238 if (canUnloadPathLoaded[*i])
239 libraryPathsToUnload.push_back(*i);
241 resourcePathsToUnload.clear();
242 cachePathsToUnload.clear();
244 return libraryPathsToUnload;
252 vector<string> libraryPathsLoaded;
254 for (vector<string>::iterator i = cachePathsLoaded.begin(); i != cachePathsLoaded.end(); ++i)
255 if (! canUnloadPathLoaded[*i])
256 libraryPathsLoaded.push_back(*i);
258 for (vector<string>::iterator i = resourcePathsLoaded.begin(); i != resourcePathsLoaded.end(); ++i)
259 if (! canUnloadPathLoaded[*i])
260 libraryPathsLoaded.push_back(*i);
262 return libraryPathsLoaded;
270 vector<string> libraryPathsLoaded;
272 for (vector<string>::iterator i = cachePathsLoaded.begin(); i != cachePathsLoaded.end(); ++i)
273 if (canUnloadPathLoaded[*i] && cachePathsToUnload.find(*i) == cachePathsToUnload.end())
274 libraryPathsLoaded.push_back(*i);
276 for (vector<string>::iterator i = resourcePathsLoaded.begin(); i != resourcePathsLoaded.end(); ++i)
277 if (canUnloadPathLoaded[*i] && resourcePathsToUnload.find(*i) == resourcePathsToUnload.end())
278 libraryPathsLoaded.push_back(*i);
280 return libraryPathsLoaded;
288 vector<string> unloadableResourcePathsLoaded;
290 for (vector<string>::iterator i = resourcePathsLoaded.begin(); i != resourcePathsLoaded.end(); ++i)
291 if (canUnloadPathLoaded[*i] && resourcePathsToUnload.find(*i) == resourcePathsToUnload.end())
292 unloadableResourcePathsLoaded.push_back(*i);
294 return unloadableResourcePathsLoaded;
302 vector<string> unloadableCachePathsLoaded;
304 for (vector<string>::iterator i = cachePathsLoaded.begin(); i != cachePathsLoaded.end(); ++i)
305 if (canUnloadPathLoaded[*i] && cachePathsToUnload.find(*i) == cachePathsToUnload.end())
306 unloadableCachePathsLoaded.push_back(*i);
308 return unloadableCachePathsLoaded;
316 set<string> dependenciesLoadedSet;
318 set<string> libraryPathsLoaded;
321 libraryPathsLoaded.insert(nonUnloadable.begin(), nonUnloadable.end());
322 libraryPathsLoaded.insert(unloadable.begin(), unloadable.end());
324 for (set<string>::iterator i = libraryPathsLoaded.begin(); i != libraryPathsLoaded.end(); ++i)
326 map<string, set<string> >::iterator j = dependenciesLoaded.find(*i);
327 if (j != dependenciesLoaded.end())
328 dependenciesLoadedSet.insert(j->second.begin(), j->second.end());
331 return dependenciesLoadedSet;
339 return ! cachePathsToUnload.empty();
348 externalLibraries.insert(paths.begin(), paths.end());
357 externalFrameworks.insert(paths.begin(), paths.end());
365 return externalLibraries;
373 return externalFrameworks;
382 this->shouldDeleteResourceLibraries = shouldDeleteResourceLibraries;