Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
32 lines
795 B
JavaScript
Executable file
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;
|