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 isPathUnloadable[path] = isUnloadable;
45 dependenciesToLoad[path] = dependenciesInLibrary;
58 if (find(cachePathsLoaded.begin(), cachePathsLoaded.end(), path) == cachePathsLoaded.end() ||
59 find(cachePathsToUnload.begin(), cachePathsToUnload.end(), path) != cachePathsToUnload.end())
61 cachePathsToLoad.push_back(path);
62 isPathUnloadable[path] = isUnloadable;
63 dependenciesToLoad[path] = dependenciesInLibrary;
72 for (map<
string, set<string> >::iterator i = dependenciesLoaded.begin(); i != dependenciesLoaded.end(); ++i)
74 if (i->second.find(dependency) != i->second.end())
76 string libraryPath = i->first;
78 if (! isPathUnloadable[libraryPath])
80 VUserLog(
"The library containing %s (%s) can't be unloaded.", dependency.c_str(), libraryPath.c_str());
84 if (find(resourcePathsLoaded.begin(), resourcePathsLoaded.end(), libraryPath) != resourcePathsLoaded.end())
85 resourcePathsToUnload.insert(libraryPath);
86 if (find(cachePathsLoaded.begin(), cachePathsLoaded.end(), libraryPath) != cachePathsLoaded.end())
87 cachePathsToUnload.insert(libraryPath);
102 vector<string> libraryPathsToLoad;
104 for (vector<string>::iterator i = cachePathsLoaded.begin(); i != cachePathsLoaded.end(); ++i)
105 if (isPathUnloadable[*i])
106 libraryPathsToLoad.push_back(*i);
108 libraryPathsToLoad.insert(libraryPathsToLoad.end(), cachePathsToLoad.begin(), cachePathsToLoad.end());
110 for (vector<string>::iterator i = resourcePathsLoaded.begin(); i != resourcePathsLoaded.end(); ++i)
111 if (isPathUnloadable[*i])
112 libraryPathsToLoad.push_back(*i);
114 libraryPathsToLoad.insert(libraryPathsToLoad.end(), resourcePathsToLoad.begin(), resourcePathsToLoad.end());
116 resourcePathsLoaded.insert(resourcePathsLoaded.end(), resourcePathsToLoad.begin(), resourcePathsToLoad.end());
117 resourcePathsToLoad.clear();
119 cachePathsLoaded.insert(cachePathsLoaded.end(), cachePathsToLoad.begin(), cachePathsToLoad.end());
120 cachePathsToLoad.clear();
122 dependenciesLoaded.insert(dependenciesToLoad.begin(), dependenciesToLoad.end());
123 dependenciesToLoad.clear();
125 return libraryPathsToLoad;
137 for (set<string>::iterator i = resourcePathsToUnload.begin(); i != resourcePathsToUnload.end(); ++i)
139 dependenciesLoaded.erase(*i);
140 isPathUnloadable.erase(*i);
142 if (shouldDeleteResourceLibraries)
146 for (
int i = resourcePathsLoaded.size()-1; i >= 0; --i)
147 if (find(resourcePathsToUnload.begin(), resourcePathsToUnload.end(), resourcePathsLoaded[i]) != resourcePathsToUnload.end())
148 resourcePathsLoaded.erase(resourcePathsLoaded.begin() + i);
150 for (
int i = cachePathsLoaded.size()-1; i >= 0; --i)
151 if (find(cachePathsToUnload.begin(), cachePathsToUnload.end(), cachePathsLoaded[i]) != cachePathsToUnload.end())
152 cachePathsLoaded.erase(cachePathsLoaded.begin() + i);
154 vector<string> libraryPathsToUnload;
156 libraryPathsToUnload.insert(libraryPathsToUnload.end(), resourcePathsToUnload.rbegin(), resourcePathsToUnload.rend());
158 for (vector<string>::reverse_iterator i = resourcePathsLoaded.rbegin(); i != resourcePathsLoaded.rend(); ++i)
159 if (isPathUnloadable[*i])
160 libraryPathsToUnload.push_back(*i);
162 libraryPathsToUnload.insert(libraryPathsToUnload.end(), cachePathsToUnload.rbegin(), cachePathsToUnload.rend());
164 for (vector<string>::reverse_iterator i = cachePathsLoaded.rbegin(); i != cachePathsLoaded.rend(); ++i)
165 if (isPathUnloadable[*i])
166 libraryPathsToUnload.push_back(*i);
168 resourcePathsToUnload.clear();
169 cachePathsToUnload.clear();
171 return libraryPathsToUnload;
179 vector<string> libraryPathsLoaded;
181 for (vector<string>::iterator i = cachePathsLoaded.begin(); i != cachePathsLoaded.end(); ++i)
182 if (! isPathUnloadable[*i])
183 libraryPathsLoaded.push_back(*i);
185 for (vector<string>::iterator i = resourcePathsLoaded.begin(); i != resourcePathsLoaded.end(); ++i)
186 if (! isPathUnloadable[*i])
187 libraryPathsLoaded.push_back(*i);
189 return libraryPathsLoaded;
197 vector<string> libraryPathsLoaded;
199 for (vector<string>::iterator i = cachePathsLoaded.begin(); i != cachePathsLoaded.end(); ++i)
200 if (isPathUnloadable[*i] && cachePathsToUnload.find(*i) == cachePathsToUnload.end())
201 libraryPathsLoaded.push_back(*i);
203 for (vector<string>::iterator i = resourcePathsLoaded.begin(); i != resourcePathsLoaded.end(); ++i)
204 if (isPathUnloadable[*i] && resourcePathsToUnload.find(*i) == resourcePathsToUnload.end())
205 libraryPathsLoaded.push_back(*i);
207 return libraryPathsLoaded;
215 set<string> dependenciesLoadedSet;
217 set<string> libraryPathsLoaded;
220 libraryPathsLoaded.insert(nonUnloadable.begin(), nonUnloadable.end());
221 libraryPathsLoaded.insert(unloadable.begin(), unloadable.end());
223 for (set<string>::iterator i = libraryPathsLoaded.begin(); i != libraryPathsLoaded.end(); ++i)
225 map<string, set<string> >::iterator j = dependenciesLoaded.find(*i);
226 if (j != dependenciesLoaded.end())
227 dependenciesLoadedSet.insert(j->second.begin(), j->second.end());
230 return dependenciesLoadedSet;
239 externalLibraries.insert(paths.begin(), paths.end());
248 externalFrameworks.insert(paths.begin(), paths.end());
256 return externalLibraries;
264 return externalFrameworks;
273 this->shouldDeleteResourceLibraries = shouldDeleteResourceLibraries;