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

Function load

Engine/StandardPaths.cpp:112–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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