Skip to content
This repository was archived by the owner on Jan 14, 2022. It is now read-only.

Commit b7af6e7

Browse files
committed
Merge pull request #4 from manifoldjs/v0.1.1
Fixed issue determining available platforms in manifoldjs project
2 parents 6e9d028 + c2541a9 commit b7af6e7

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

lib/projectTools.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,22 @@ function getProjectPlatforms (dir) {
114114
// get available platform IDs
115115
var availablePlatforms = platformTools.listPlatforms();
116116

117-
// search child platform folders
118-
return Q.nfcall(fs.readdir, dir).then(function (files) {
119-
var platforms = files.filter(function (file) {
117+
return getProjectRoot(dir || process.cwd()).then(function (rootDir) {
120118

121-
// filter folders not matching a platform ID
122-
return availablePlatforms.indexOf(file) >= 0;
119+
if (!rootDir) {
120+
return Q.reject(new Error('The specified directory does not appear to contain a valid manifoldjs project.'));
121+
}
122+
123+
// search child platform folders
124+
return Q.nfcall(fs.readdir, rootDir).then(function (files) {
125+
var platforms = files.filter(function (file) {
126+
127+
// filter folders not matching a platform ID
128+
return availablePlatforms.indexOf(file) >= 0;
129+
});
130+
131+
return platforms;
123132
});
124-
125-
return platforms;
126133
});
127134
}
128135

0 commit comments

Comments
 (0)