FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
node-java/scripts/postInstall.js at master · joeferner/node-java · GitHub
joeferner
/
node-java
Public
Notifications
You must be signed in to change notification settings
Fork
288
Star
1.9k
Code
Issues
208
Pull requests
7
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
node-java
/
scripts
/
postInstall.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
61 lines (50 loc) · 1.42 KB
Breadcrumbs
node-java
/
scripts
/
postInstall.js
Copy path
File metadata and controls
61 lines (50 loc) · 1.42 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
const
glob
=
require
(
"glob"
)
;
const
fs
=
require
(
"fs"
)
;
const
path
=
require
(
"path"
)
;
const
os
=
require
(
"os"
)
;
require
(
"find-java-home"
)
(
(
err
,
home
)
=>
{
if
(
home
)
{
const
dll
=
glob
.
sync
(
"**/jvm.dll"
,
{
cwd
:
home
}
)
[
0
]
;
const
dylib
=
glob
.
sync
(
"**/libjli.dylib"
,
{
cwd
:
home
}
)
[
0
]
;
const
soFiles
=
glob
.
sync
(
"**/libjvm.so"
,
{
cwd
:
home
}
)
;
let
so
;
if
(
soFiles
.
length
>
0
)
{
so
=
getCorrectSoForPlatform
(
soFiles
)
;
}
const
binary
=
dll
??
dylib
??
so
;
fs
.
writeFileSync
(
path
.
resolve
(
__dirname
,
"../build/jvm_dll_path.json"
)
,
binary
?
JSON
.
stringify
(
path
.
delimiter
+
path
.
dirname
(
path
.
resolve
(
home
,
binary
)
)
)
:
'""'
)
;
}
}
)
;
function
getCorrectSoForPlatform
(
soFiles
)
{
let
so
=
_getCorrectSoForPlatform
(
soFiles
)
;
if
(
so
)
{
so
=
removeDuplicateJre
(
so
)
;
}
return
so
;
}
function
removeDuplicateJre
(
filePath
)
{
while
(
filePath
.
indexOf
(
"jre/jre"
)
>=
0
)
{
filePath
=
filePath
.
replace
(
"jre/jre"
,
"jre"
)
;
}
return
filePath
;
}
function
_getCorrectSoForPlatform
(
soFiles
)
{
const
architectureFolderNames
=
{
ia32
:
"i386"
,
x64
:
"amd64"
,
}
;
if
(
os
.
platform
(
)
!=
"sunos"
)
{
return
soFiles
[
0
]
;
}
const
requiredFolderName
=
architectureFolderNames
[
os
.
arch
(
)
]
;
for
(
let
i
=
0
;
i
<
soFiles
.
length
;
i
++
)
{
const
so
=
soFiles
[
i
]
;
if
(
so
.
indexOf
(
"server"
)
>
0
&&
so
.
indexOf
(
requiredFolderName
)
>
0
)
{
return
so
;
}
}
return
soFiles
[
0
]
;
}
Back
|
FazBrowse Home
|
New Git URL