1 | os = require("os")
|
2 | path = require("path")
|
3 |
|
4 | distPath = "dist/Cypress"
|
5 |
|
6 | execPath = {
|
7 | darwin: "Cypress.app/Contents/MacOS/Cypress"
|
8 | freebsd: "Cypress"
|
9 | linux: "Cypress"
|
10 |
|
11 | }
|
12 |
|
13 | resourcesPath = {
|
14 | darwin: "Cypress.app/Contents/Resources"
|
15 | freebsd: "resources"
|
16 | linux: "resources"
|
17 |
|
18 | }
|
19 |
|
20 | unknownPlatformErr = ->
|
21 | throw new Error("Unknown platform: '#{os.platform()}'")
|
22 |
|
23 | normalize = (paths...) ->
|
24 | path.join(__dirname, "..", paths...)
|
25 |
|
26 | module.exports = {
|
27 | getPathToDist: (paths...) ->
|
28 | paths = [distPath].concat(paths)
|
29 |
|
30 | normalize(paths...)
|
31 |
|
32 | getPathToExec: ->
|
33 | p = execPath[os.platform()] ? unknownPlatformErr()
|
34 |
|
35 | @getPathToDist(p)
|
36 |
|
37 | getPathToResources: (paths...) ->
|
38 | p = resourcesPath[os.platform()] ? unknownPlatformErr()
|
39 |
|
40 | p = [].concat(p, paths)
|
41 |
|
42 | @getPathToDist(p...)
|
43 |
|
44 | getPathToVersion: ->
|
45 | @getPathToDist("version")
|
46 |
|
47 | } |
\ | No newline at end of file |