Re: If you wanted to distribute a dll
- Posted by ghaberek (admin) Sep 14, 2015
- 1508 views
xecronix said...
public function include_derived_ext_paths(sequence libdir, sequence lib) -- *snip* --
This does not currently work on Windows. The join_path() function adds a leading backslash to the path if the first element is not a root directory (i.e. C:\).
include std/console.e include std/filesys.e display( join_path({ "C:\\", "Euphoria", "bin" }) ) display( join_path({ "C:\\Euphoria", "bin" }) ) maybe_any_key()
C:\Euphoria\bin \C:\Euphoria\bin
I suggest adding an ifdef WINDOWS block to handle this accordingly for now.
namespace libhelper include std/filesys.e public function include_derived_ext_paths(sequence libdir, sequence lib) sequence inc_paths = include_paths(1) sequence retval = {} sequence dll_name = sprintf("%s.%s", {lib, SHARED_LIB_EXT}) retval = append(retval, dll_name) sequence current = join_path({current_dir(), dll_name}) ifdef WINDOWS then if current[1] = '\\' then -- trim leading backslash character current = current[2..$] end if end ifdef retval = append(retval, current) for i = 1 to length(inc_paths) do sequence inc_path = inc_paths[i] sequence last_char = {inc_path[$]} if equal(last_char, SLASH) then inc_path = inc_path[1..$-1] end if retval = append(retval, join_path({inc_path, libdir, "ext", dll_name})) end for return retval end function
-Greg