UNPKG

914 Btext/coffeescriptView Raw
1os = require("os")
2path = require("path")
3
4distPath = "dist/Cypress"
5
6execPath = {
7 darwin: "Cypress.app/Contents/MacOS/Cypress"
8 freebsd: "Cypress"
9 linux: "Cypress"
10 # win32: "dist/Cypress.exe"
11}
12
13resourcesPath = {
14 darwin: "Cypress.app/Contents/Resources"
15 freebsd: "resources"
16 linux: "resources"
17 # win32: "resources"
18}
19
20unknownPlatformErr = ->
21 throw new Error("Unknown platform: '#{os.platform()}'")
22
23normalize = (paths...) ->
24 path.join(__dirname, "..", paths...)
25
26module.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