File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 20
20
21
21
var isDirectory = new interop . Reference ( interop . types . bool , false ) ;
22
22
23
+ var pathCache = new Map ( ) ;
23
24
function __findModule ( moduleIdentifier , previousPath ) {
24
25
var isBootstrap = ! previousPath ;
25
26
if ( isBootstrap ) {
36
37
absolutePath = NSString . pathWithComponents ( [ applicationPath , moduleDir , moduleIdentifier ] ) ;
37
38
}
38
39
40
+ var requestedPath = absolutePath ;
41
+ if ( pathCache . has ( requestedPath ) ) {
42
+ return pathCache . get ( requestedPath ) ;
43
+ }
44
+
39
45
if ( fileManager . fileExistsAtPathIsDirectory ( absolutePath , isDirectory ) ) {
40
46
if ( ! isDirectory . value ) {
41
47
throw new ModuleError ( "Expected '" + absolutePath + "' to be a directory" ) ;
68
74
69
75
//console.debug('FIND_MODULE:', moduleIdentifier, absolutePath);
70
76
71
- return {
77
+ var moduleMetadata = {
72
78
name : nsstr ( moduleIdentifier ) . lastPathComponent ,
73
79
path : absolutePath ,
74
80
bundlePath : absolutePath . substr ( applicationPath . length )
75
81
} ;
82
+
83
+ pathCache . set ( requestedPath , moduleMetadata ) ;
84
+ return moduleMetadata ;
76
85
} else {
77
86
throw new ModuleError ( "Failed to find module '" + moduleIdentifier + "' relative to '" + previousPath + "'. Computed path: " + absolutePath ) ;
78
87
}
You can’t perform that action at this time.
0 commit comments