VulpesOS/gaia/tests/jsmarionette/runner/mozilla-profile-builder/lib/gaiaprofile.js
OverSu b38dea0597 Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
2026-09-30 23:13:03 +02:00

32 lines
795 B
JavaScript
Executable file

'use strict';
var fsPath = require('path'),
fs = require('fs');
/**
* Detects the gaia profile inside of a runtime directory.
*
* @param {String} path of runtime.
* @return {String} location of base profile.
*/
function gaiaProfile (basePath, callback) {
var foundPath = false;
var pending = 2;
function next(path, exists) {
if (exists) {
foundPath = true;
callback(null, path);
}
if (--pending === 0 && !foundPath) {
callback(new Error('could not find path to gaia profile'));
}
}
var linux = fsPath.join(basePath, 'gaia', 'profile');
fs.exists(linux, next.bind(null, linux));
var macos = fsPath.join(basePath, 'Contents', 'Resources', 'gaia', 'profile');
fs.exists(macos, next.bind(null, macos));
}
module.exports = gaiaProfile;