mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 07:53:22 +02:00
This commit introduce a new option to use a new minicap implementation by specifying --screen-grabber or the env variable SCREEN_GRABBER. The current native minicap is the default and is refered as 'minicap-bin'. The new minicap which is packaged in an apk is usable with 'minicap-apk' and will be used as a fallback. At the moment, this apk is expected to be included in minicap-prebuilt node package at this location minicap-prebuilt/prebuilt/noarch/minicap.apk. STFService.apk has also been updated to take into account Android 12 Signed-off-by: Crepieux Pierre <pierre.crepieux@orange.com>
47 lines
1022 B
JavaScript
47 lines
1022 B
JavaScript
var path = require('path')
|
|
var fs = require('fs')
|
|
var util = require('util')
|
|
|
|
// Export
|
|
module.exports.root = function(target) {
|
|
return path.resolve(__dirname, '../..', target)
|
|
}
|
|
|
|
// Export
|
|
module.exports.resource = function(target) {
|
|
return path.resolve(__dirname, '../../res', target)
|
|
}
|
|
|
|
// Export
|
|
module.exports.vendor = function(target) {
|
|
return path.resolve(__dirname, '../../vendor', target)
|
|
}
|
|
|
|
// Export
|
|
module.exports.module = function(target) {
|
|
return path.resolve(__dirname, '../../node_modules', target)
|
|
}
|
|
|
|
// Export
|
|
module.exports.match = function(candidates) {
|
|
for (var i = 0, l = candidates.length; i < l; ++i) {
|
|
if (fs.existsSync(candidates[i])) {
|
|
return candidates[i]
|
|
}
|
|
}
|
|
return undefined
|
|
}
|
|
|
|
// Export
|
|
module.exports.requiredMatch = function(candidates) {
|
|
matched = this.match(candidates)
|
|
if(matched !== undefined) {
|
|
return matched
|
|
} else {
|
|
throw new Error(util.format(
|
|
'At least one of these paths should exist: %s'
|
|
, candidates.join(', ')
|
|
))
|
|
}
|
|
}
|