question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to add folder to autoload paths?

See original GitHub issue

Hello! I try to load with ffi.Library() some library located at the certain directory (for example lib/myLib.dll). But this library is linked to another library (for example core.dll). I thought myLib.dll would search for core library at the same folder (lib/core.dll), but it searches core library at the application’s root folder (I know this because I tried to move core.dll to the root application folder and loading works). So how can I add lib/ path to the autoload paths? I mean, paths which are traversed when one dll tries to load another it depens on?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:20 (3 by maintainers)

github_iconTop GitHub Comments

9reactions
insightcodercommented, Mar 22, 2018

@BONDbATIF

Try something like this:

var libPath = path.join(__dirname, '..', 'server', 'spotpro_bin');
var libName = process.platform === "win32" ? 'SCMuiWrapper' : 'libSCMuiWrapper';
process.env.PATH = `${process.env.PATH}${path.delimiter}${libPath}`;

var wrapperLibrary = ffi.Library(libName, {...})
7reactions
insightcodercommented, Jan 23, 2018

Windows looks for DLLs on your system path, so you can either add the directories to the Path environmental variable, or you can modify the Path as you are going. Here is what I am doing that seems to be working for now:

var oldPath = process.env.PATH;
var dllPath = 'path/to/dlls';
process.env['PATH'] = `${process.env.PATH};${dllPath}`;

var lib = ffi.Library('MyLibrary', {});

process.env['PATH'] = oldPath;
Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding a directory to the load path in Rails? - Stack Overflow
create a new folder and class inside the /app directory; run spring stop on the command line; check the autoload-paths with bin/rails r...
Read more >
Autoloading and Reloading Constants - Ruby on Rails Guides
Rails adds custom directories under app to the autoload paths automatically. For example, if your application has app/presenters , you don't need to...
Read more >
How to use rails load paths, app, and lib directories. · GitHub
Another option is to add your whole lib dir into autoload_paths : config.autoload_paths += %W( #{config.root}/lib ) . This means you shouldn't explicitly ......
Read more >
Making Rails recognize code in subfolders of default folders
I can change that by adding subfolders of any folder that's there by default to the autoload paths in config/application.rb .
Read more >
The composer.json schema
autoload -dev (root-only); include-path; target-dir; minimum-stability ... If you want to exclude some files or folders from the classmap you can use the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found