@@ -796,6 +796,17 @@ function platform_dlext(p::AbstractPlatform = HostPlatform())
796796 end
797797end
798798
799+ # Not general purpose, just for parse_dl_name_version
800+ function _this_os_name ()
801+ if Sys. iswindows ()
802+ return " windows"
803+ elseif Sys. isapple ()
804+ return " macos"
805+ else
806+ return " other"
807+ end
808+ end
809+
799810"""
800811 parse_dl_name_version(path::String, platform::AbstractPlatform)
801812
@@ -806,9 +817,10 @@ valid dynamic library, this method throws an error. If no soversion
806817can be extracted from the filename, as in "libbar.so" this method
807818returns `"libbar", nothing`.
808819"""
809- function parse_dl_name_version (path:: String , os:: String )
820+ function parse_dl_name_version (path:: String , os:: String = _this_os_name () )
810821 # Use an extraction regex that matches the given OS
811822 local dlregex
823+ # Keep this up to date with _this_os_name
812824 if os == " windows"
813825 # On Windows, libraries look like `libnettle-6.dll`
814826 dlregex = r" ^(.*?)(?:-((?:[\.\d ]+)*))?\. dll$" s a
@@ -837,7 +849,7 @@ function parse_dl_name_version(path::String, os::String)
837849end
838850
839851# Adapter for `AbstractString`
840- function parse_dl_name_version (path:: AbstractString , os:: AbstractString )
852+ function parse_dl_name_version (path:: AbstractString , os:: AbstractString = _this_os_name () )
841853 return parse_dl_name_version (string (path):: String , string (os):: String )
842854end
843855
0 commit comments