UNPKG

714 Btext/coffeescriptView Raw
1pathModule = require("path")
2os = require "os"
3fs = require "fs"
4exports.copySync = (from,to)->
5 symlinkSupports = ["linux","darwin"]
6 if os.platform() in symlinkSupports
7 if not fs.existsSync pathModule.resolve from
8 throw new Error "file #{pathModule.resolve from} not exists"
9 fs.symlinkSync (pathModule.resolve from),to
10 else
11 throw new Error "leafjs-tester not support on your platform"
12exports.getFileInSearchPath = (file,pathes)->
13 for path in pathes
14 if fs.existsSync pathModule.resolve path,file
15 return fs.readFileSync (pathModule.resolve path,file),"utf8"
16 throw new Error "file #{file} not found in search pathes:\n #{pathes.join('\n')}"
\No newline at end of file