mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-26 18:42:41 +01: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();
|
static std::string prefix();
|
||||||
/// Returns the platform-specific filename prefix
|
/// Returns the platform-specific filename prefix
|
||||||
/// for shared libraries.
|
/// 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.
|
/// on Cygwin, the "cyg" prefix will be returned.
|
||||||
|
|
||||||
static std::string suffix();
|
static std::string suffix();
|
||||||
@@ -130,6 +130,11 @@ public:
|
|||||||
/// In debug mode, the suffix also includes a
|
/// In debug mode, the suffix also includes a
|
||||||
/// "d" to specify the debug version of a library.
|
/// "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:
|
private:
|
||||||
SharedLibrary(const SharedLibrary&);
|
SharedLibrary(const SharedLibrary&);
|
||||||
SharedLibrary& operator = (const SharedLibrary&);
|
SharedLibrary& operator = (const SharedLibrary&);
|
||||||
|
|||||||
@@ -115,5 +115,9 @@ std::string SharedLibrary::suffix()
|
|||||||
return suffixImpl();
|
return suffixImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string SharedLibrary::getOSName(const std::string& name)
|
||||||
|
{
|
||||||
|
return prefix() + name + suffix();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Poco
|
} // namespace Poco
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ const std::string& SharedLibraryImpl::getPathImpl() const
|
|||||||
|
|
||||||
std::string SharedLibraryImpl::prefixImpl()
|
std::string SharedLibraryImpl::prefixImpl()
|
||||||
{
|
{
|
||||||
return "";
|
return "lib";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ std::string SharedLibraryImpl::prefixImpl()
|
|||||||
#if POCO_OS == POCO_OS_CYGWIN
|
#if POCO_OS == POCO_OS_CYGWIN
|
||||||
return "cyg";
|
return "cyg";
|
||||||
#else
|
#else
|
||||||
return "";
|
return "lib";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user