Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

Commit

Permalink
Search in cmake-build-debug and cmake-build-release for CLion conveni…
Browse files Browse the repository at this point in the history
…ence
  • Loading branch information
TomMettam committed May 13, 2021
1 parent 10b074a commit d863f67
Showing 1 changed file with 36 additions and 6 deletions.
42 changes: 36 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@ function requireNativeModule(name, debug) {
// Suffixes to search for (in each mode)
// Both are used, debug just changes which is tried first
var search = {
debug: path.join('build', 'Debug', name + '.node'),
release: path.join('build', 'Release', name + '.node')
debug: [
path.join('build', 'Debug', name + '.node'),
path.join('cmake-build-debug', name + '.node')
],
release: [
path.join('build', 'Release', name + '.node'),
path.join('cmake-build-release', name + '.node')
]
};

var root = base;
Expand All @@ -22,14 +28,38 @@ function requireNativeModule(name, debug) {
// Walk upward to the root of the current drive
while(same < 2 || found) {
try {
location = path.join(root, (debug) ? search.debug : search.release);
found = fs.statSync(location);
const paths = (debug) ? search.debug : search.release;
for(const p of paths)
{
location = path.join(root, p);
found = false;
try {
found = fs.statSync(location);
}
catch(e){}
if (found)
{
break;
}
}
}
catch(e) {}
if(!found) {
try {
location = path.join(root, (debug) ? search.release : search.debug);
found = fs.statSync(location);
const paths = (debug) ? search.release : search.debug;
for(const p of paths)
{
location = path.join(root, p);
found = false;
try {
found = fs.statSync(location);
}
catch(e){}
if (found)
{
break;
}
}
}
catch(e) {}
}
Expand Down

0 comments on commit d863f67

Please sign in to comment.