Skip to content

Commit

Permalink
Fix plugin dir finding for windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
abellgithub committed Jul 16, 2020
1 parent 4b643c8 commit 346a542
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
5 changes: 2 additions & 3 deletions io/private/ept/TileContents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,8 @@ void TileContents::readZstandard()
transform();
}
#else
void TileContents::readZstandard() const
{
}
void TileContents::readZstandard()
{}
#endif // PDAL_HAVE_ZSTD

void TileContents::readAddon(const Addon& addon)
Expand Down
6 changes: 3 additions & 3 deletions pdal/PDALUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,16 +410,16 @@ std::string dllDir()
{
std::string s;

#ifdef WIN32
#ifdef _WIN32
HMODULE hm = NULL;

if (GetModuleHandleEx(
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
(LPCSTR)&dllDir, &hm))
{
wchar_t path[MAX_PATH];
DWORD cnt = GetModuleFileName(hm, path, sizeof(path));
char path[MAX_PATH];
DWORD cnt = GetModuleFileNameA(hm, path, sizeof(path));
if (cnt > 0 && cnt < MAX_PATH)
s = path;
}
Expand Down
3 changes: 0 additions & 3 deletions pdal/PluginDirectory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ StringList pluginSearchPaths()
{
s = FileUtils::toCanonicalPath(s);
if (s.size() && !Utils::contains(searchPaths, s))
{
searchPaths.push_back(s);
std::cerr << "Search path = " << s << "!\n";
}
}
}
return searchPaths;
Expand Down
5 changes: 3 additions & 2 deletions pdal/util/FileUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,13 @@ std::string getcwd()
}


std::string toCanonicalPath(const std::string& filename)
std::string toCanonicalPath(std::string filename)
{
std::string result;

#ifdef _WIN32
char buf[MAX_PATH]
filename = addTrailingSlash(filename);
char buf[MAX_PATH];
if (GetFullPathName(filename.c_str(), MAX_PATH, buf, NULL))
result = buf;
#else
Expand Down
2 changes: 1 addition & 1 deletion pdal/util/FileUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ namespace FileUtils
\param filename Name of file to convert to canonical path.
\return Canonical version of provided filename, or empty string.
*/
PDAL_DLL std::string toCanonicalPath(const std::string& filename);
PDAL_DLL std::string toCanonicalPath(std::string filename);


/**
Expand Down

0 comments on commit 346a542

Please sign in to comment.