MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / load

Function load

Engine/StandardPaths.cpp:114–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112}
113
114static HINSTANCE
115load(const wchar_t *libraryName,
116 bool onlySystemDirectory = true)
117{
118 QStringList searchOrder;
119
120#if !defined(QT_BOOTSTRAPPED)
121 if (!onlySystemDirectory) {
122 searchOrder << QFileInfo( QCoreApplication::applicationFilePath() ).path();
123 }
124#endif
125 searchOrder << qSystemDirectory();
126
127 if (!onlySystemDirectory) {
128 const QString PATH( QLatin1String( qgetenv("PATH").constData() ) );
129# ifdef __NATRON_WIN32__
130 const QChar pathSep = QChar::fromLatin1(';');
131# else
132 // This code is windows-only anyway, but this is here for consistency with other parts of the source
133 const QChar pathSep = QChar::fromLatin1(':');
134# endif
135 searchOrder << PATH.split(pathSep, QString::SkipEmptyParts);
136 }
137 QString fileName = QString::fromWCharArray(libraryName);
138 fileName.append( QLatin1String(".dll") );
139
140 // Start looking in the order specified
141 Q_FOREACH(const QString &path, searchOrder) {
142 QString fullPathAttempt = path;
143
144 if ( !fullPathAttempt.endsWith( QLatin1Char('\\') ) ) {
145 fullPathAttempt.append( QLatin1Char('\\') );
146 }
147 fullPathAttempt.append(fileName);
148
149 std::wstring ws = fullPathAttempt.toStdWString();
150 HINSTANCE inst = ::LoadLibraryW( ws.c_str() );
151
152 if (inst != 0) {
153 return inst;
154 }
155 }
156
157 return 0;
158}
159
160typedef BOOL (WINAPI * GetSpecialFolderPath)(HWND, LPWSTR, int, BOOL);
161static GetSpecialFolderPath

Callers 6

loadMethod · 0.70
loadMethod · 0.70
loadMethod · 0.70
loadMethod · 0.70
loadProjectInternalMethod · 0.70

Calls 4

QFileInfoClass · 0.85
qSystemDirectoryFunction · 0.85
appendMethod · 0.80
pathMethod · 0.45

Tested by

no test coverage detected