This commit is contained in:
Chen Shen
2015-09-17 09:52:00 -07:00
parent 02457990f1
commit 20dcdf77a4
10 changed files with 5 additions and 3 deletions

View File

@@ -20,8 +20,10 @@ describe "Package", ->
expect(pack.incompatibleModules[0].path).toBe path.join(packagePath, 'node_modules', 'native-module')
it "utilizes _atomModuleCache to get native modules and skips traversing through submodules", ->
packagePath = atom.project.getDirectories()[0]?.resolve('packages/package-with-both-incompatible-and-compatible-native-modules')
packagePath = atom.project.getDirectories()[0]?.resolve('packages/package-with-ignored-incompatible-native-module')
pack = new Package(packagePath)
# Since `_atomModuleCache` exists and it doesn't have the record of the
# incompatible native module, this package is recognized as compatible.
expect(pack.isCompatible()).toBe true
it "caches the incompatible native modules in local storage", ->

View File

@@ -598,10 +598,10 @@ class Package
nativeModulePaths = []
if @metadata._atomModuleCache?
nativeModuleBindingPaths = @metadata._atomModuleCache.extensions?['.node'] ?[]
nativeModuleBindingPaths = @metadata._atomModuleCache.extensions?['.node'] ? []
for nativeModuleBindingPath in nativeModuleBindingPaths
# The `.node` file lies in nativeModulePath/build/Release/ folder.
nativeModulePath = path.normalize(path.join(path.dirname(nativeModuleBindingPath), '..', '..'))
nativeModulePath = path.join(path.dirname(nativeModuleBindingPath), '..', '..')
nativeModulePaths.push(nativeModulePath) if @isNativeModule(nativeModulePath)
return nativeModulePaths