Skip to content

Commit 09080cb

Browse files
Merge pull request #3 from chris-smith/kinetic-devel
Fix messages from workspace overlays
2 parents 8b2a44a + b6cf5e2 commit 09080cb

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

utils/message_utils.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ let fs = require('fs');
2121
let path = require('path');
2222
let log = require('./logger.js').createLogger();
2323

24+
// When sourcing your workspace, CMAKE_PREFIX_PATH is AUTOMATICALLY
25+
// prepended with the devel directory of your workspace. Workspace
26+
// chaining works by continuing this path prepending.
2427
let cmakePath = process.env.CMAKE_PREFIX_PATH;
2528
let cmakePaths = cmakePath.split(':');
2629
let jsMsgPath = 'share/node_js/ros';
@@ -48,8 +51,12 @@ let MessageUtils = {
4851
if (fs.existsSync(path_)) {
4952
let msgPackages = fs.readdirSync(path_);
5053
msgPackages.forEach((msgPackage) => {
51-
let indexPath = path.join(path_, msgPackage, '_index.js');
52-
messagePackagePathMap[msgPackage] = indexPath;
54+
// If the message package has been found in a previous workspace,
55+
// don't overwrite it now. This is critical to enabling ws overlays.
56+
if (!messagePackagePathMap.hasOwnProperty(msgPackage)) {
57+
let indexPath = path.join(path_, msgPackage, '_index.js');
58+
messagePackagePathMap[msgPackage] = indexPath;
59+
}
5360
});
5461
}
5562
});

0 commit comments

Comments
 (0)