Skip to content

Commit

Permalink
More helpful errors
Browse files Browse the repository at this point in the history
  • Loading branch information
cannam committed Jun 19, 2013
1 parent 1819352 commit 7101ea6
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions remotevstclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,30 @@ RemoteVSTClient::RemoteVSTClient(std::string dllName, bool showGUI) :

bool found = false;

std::string sought;

for (size_t i = 0; i < dssiPath.size(); ++i) {

std::string subDir = dssiPath[i] + "/dssi-vst";
std::string fileName = subDir + "/dssi-vst-server.exe";

DIR *directory = opendir(subDir.c_str());
if (!directory) {
sought += " " + fileName;
continue;
}
closedir(directory);

struct stat st;
std::string fileName = subDir + "/dssi-vst-server.exe";

if (stat(fileName.c_str(), &st)) {
sought += " " + fileName;
continue;
}

if (!(S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) ||
!(st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) {

sought += " " + fileName;
std::cerr << "RemoteVSTClient: file " << fileName
<< " exists but can't be executed" << std::endl;
continue;
Expand Down Expand Up @@ -94,7 +98,8 @@ RemoteVSTClient::RemoteVSTClient(std::string dllName, bool showGUI) :

if (!found) {
cleanup();
throw((std::string)"Failed to find dssi-vst-server.exe");
throw(std::string("Failed to find dssi-vst-server.exe [tried:" +
sought + "]"));
} else {
syncStartup();
}
Expand Down Expand Up @@ -316,26 +321,30 @@ RemoteVSTClient::queryPlugins(std::vector<PluginRecord> &plugins)
bool found = false;
pid_t child;

std::string sought;

for (size_t i = 0; i < dssiPath.size(); ++i) {

std::string subDir = dssiPath[i] + "/dssi-vst";
std::string fileName = subDir + "/dssi-vst-scanner.exe";

DIR *directory = opendir(subDir.c_str());
if (!directory) {
sought += " " + fileName;
continue;
}
closedir(directory);

struct stat st;
std::string fileName = subDir + "/dssi-vst-scanner.exe";

if (stat(fileName.c_str(), &st)) {
sought += " " + fileName;
continue;
}

if (!(S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) ||
!(st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) {

sought += " " + fileName;
std::cerr << "RemoteVSTClient: file " << fileName
<< " exists but can't be executed" << std::endl;
continue;
Expand All @@ -362,7 +371,8 @@ RemoteVSTClient::queryPlugins(std::vector<PluginRecord> &plugins)

if (!found) {
unlink(fifoFile);
throw((std::string)"Failed to find dssi-vst-scanner.exe");
throw(std::string("Failed to find dssi-vst-scanner.exe [tried:" +
sought + "]"));
}

struct pollfd pfd;
Expand Down Expand Up @@ -401,6 +411,9 @@ RemoteVSTClient::queryPlugins(std::vector<PluginRecord> &plugins)

tryRead(fd, &version, sizeof(int));
if (version != int(RemotePluginVersion * 1000)) {
std::cerr << "RemoteVSTClient: Remote plugin version reported as "
<< version << ", I expected "
<< (RemotePluginVersion * 1000) << std::endl;
throw ((std::string)"Plugin scanner version mismatch");
}

Expand Down

0 comments on commit 7101ea6

Please sign in to comment.