summaryrefslogtreecommitdiffhomepage
path: root/file.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'file.cpp')
-rw-r--r--file.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/file.cpp b/file.cpp
index 31695e5..b5cbe36 100644
--- a/file.cpp
+++ b/file.cpp
@@ -94,6 +94,19 @@ std::filesystem::path soname_short(const std::filesystem::path& p)
return result;
}
+// e.g.
+// subdir1/libxyz.so.1.2.3 -> xyz
+// libabc.so -> abc
+// file1.so.1 -> file1
+std::string dynamic_lib_name(const std::filesystem::path& p)
+{
+ std::string result {p.stem().string()};
+ if (result.substr(0, 3) == "lib") {
+ result = result.substr(3);
+ }
+ return result;
+}
+
bool is_static_lib(const std::filesystem::path& p)
{
return p.extension() == ".a";