comparison main/main.cpp @ 592:164fa1ee2642

Fix calculation of Vamp path based on application file name
author Chris Cannam
date Tue, 17 Sep 2019 11:25:37 +0100
parents 2090dd9bfbc1
children b76234d1a217
comparison
equal deleted inserted replaced
591:5e4e23fb70bd 592:164fa1ee2642
158 #else 158 #else
159 QChar sep(':'); 159 QChar sep(':');
160 #endif 160 #endif
161 161
162 if (tonyVampPath == "") { 162 if (tonyVampPath == "") {
163 tonyVampPath = QApplication::applicationDirPath(); 163
164 QString appName = QApplication::applicationName();
165 QString myDir = QApplication::applicationDirPath();
166 QString binaryName = QFileInfo(QCoreApplication::arguments().at(0))
167 .fileName();
164 168
165 #ifdef Q_OS_WIN32 169 #ifdef Q_OS_WIN32
166 QString programFiles = getEnvQStr("ProgramFiles"); 170 QString programFiles = getEnvQStr("ProgramFiles");
167 if (programFiles == "") programFiles = "C:\\Program Files"; 171 if (programFiles == "") programFiles = "C:\\Program Files";
168 QString defaultTonyPath(programFiles + "\\Tony"); 172 QString pfPath(programFiles + "\\" + appName);
169 tonyVampPath = tonyVampPath + sep + defaultTonyPath; 173 myVampPath = myDir + sep + pfPath;
170 #else 174 #else
171 #ifdef Q_OS_MAC 175 #ifdef Q_OS_MAC
172 tonyVampPath = tonyVampPath + "/../Resources:" + tonyVampPath; 176 myVampPath = myDir + "/../Resources";
173 #else 177 #else
174 QString defaultTonyPath("/usr/local/lib/tony:/usr/lib/tony"); 178 if (binaryName != "") {
175 tonyVampPath = tonyVampPath + sep + defaultTonyPath; 179 myVampPath =
180 myDir + "/../lib/" + binaryName + sep;
181 }
182 myVampPath = myVampPath +
183 myDir + "/../lib/" + appName + sep +
184 myDir;
176 #endif 185 #endif
177 #endif 186 #endif
178 } 187 }
179 188
180 std::vector<std::string> vampPathList = 189 std::vector<std::string> vampPathList =