Skip to content

Commit

Permalink
On Windows, also try to find producers in sub directories of current …
Browse files Browse the repository at this point in the history
…library
  • Loading branch information
heikohimu committed Jul 14, 2021
1 parent 2e085b2 commit 2ea6d68
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions rc_genicam_api/system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,41 @@ bool System::setSystemsPath(const char *path, const char *ignore)
if (p != 0) *p='\0';

path_to_exe=procpath;
system_path+=";" + path_to_exe;

if (system_path.size() > 0) system_path+=";";

system_path += path_to_exe;
}

// another fallback is the path to the current library

const auto path_to_this_dll = getPathToThisDll();
if (!path_to_this_dll.empty() && path_to_this_dll != path_to_exe)
{
system_path += ";" + path_to_this_dll;
if (system_path.size() > 0) system_path+=";";

system_path += path_to_this_dll;
}

// and possible sub-directories of the library

HANDLE file_handle;
WIN32_FIND_DATA file_info;

file_handle=FindFirstFileA((path_to_this_dll+"\\*").c_str(), &file_info);
if (file_handle != INVALID_HANDLE_VALUE)
{
do
{
if ((file_info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0 && file_info.cFileName[0] != '.' )
{
system_path += ";" + path_to_this_dll + "\\" + file_info.cFileName;
}
}
while (FindNextFileA(file_handle, &file_info));

FindClose(file_handle);
}
#else
// otherwise, use the absolute install path to the default transport layer

Expand Down

0 comments on commit 2ea6d68

Please sign in to comment.