mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-25 18:22:59 +02:00
add SharedLibrary::getOSName() to improve portability of shared library
real filename over different OS like Linux/Unix/Cygwin & Windows. Signed-off-by: FrancisANDRE <zosrothko@orange.fr>
This commit is contained in:
@@ -121,7 +121,7 @@ public:
|
||||
static std::string prefix();
|
||||
/// Returns the platform-specific filename prefix
|
||||
/// for shared libraries.
|
||||
/// Most platforms would return an empty string, but
|
||||
/// Most platforms would return "lib" as prefix, while
|
||||
/// on Cygwin, the "cyg" prefix will be returned.
|
||||
|
||||
static std::string suffix();
|
||||
@@ -130,6 +130,11 @@ public:
|
||||
/// In debug mode, the suffix also includes a
|
||||
/// "d" to specify the debug version of a library.
|
||||
|
||||
static std::string getOSName(const std::string& name);
|
||||
/// Returns the platform-specific filename
|
||||
/// for shared libraries by prefixing and suffixing name
|
||||
/// with prefix() and suffix()
|
||||
|
||||
private:
|
||||
SharedLibrary(const SharedLibrary&);
|
||||
SharedLibrary& operator = (const SharedLibrary&);
|
||||
|
||||
@@ -115,5 +115,9 @@ std::string SharedLibrary::suffix()
|
||||
return suffixImpl();
|
||||
}
|
||||
|
||||
std::string SharedLibrary::getOSName(const std::string& name)
|
||||
{
|
||||
return prefix() + name + suffix();
|
||||
}
|
||||
|
||||
} // namespace Poco
|
||||
|
||||
@@ -85,7 +85,7 @@ const std::string& SharedLibraryImpl::getPathImpl() const
|
||||
|
||||
std::string SharedLibraryImpl::prefixImpl()
|
||||
{
|
||||
return "";
|
||||
return "lib";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ std::string SharedLibraryImpl::prefixImpl()
|
||||
#if POCO_OS == POCO_OS_CYGWIN
|
||||
return "cyg";
|
||||
#else
|
||||
return "";
|
||||
return "lib";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user