コード例 #1
0
ファイル: index.js プロジェクト: captainsafia/jupyter-paths
function configDirs(opts) {
  var paths = [];
  if (process.env.JUPYTER_CONFIG_DIR) {
    paths.push(process.env.JUPYTER_CONFIG_DIR);
  }

  paths.push(home('.jupyter'));

  if (opts && opts.withSysPrefix) {
    return sysPrefixPromise()
            .then(sysPrefix => path.join(sysPrefix, 'etc', 'jupyter'))
            .then(sysPathed => {
              paths.push(sysPathed);
              return paths.concat(systemConfigDirs());
            });
  }
  return paths.concat(systemConfigDirs());
}
コード例 #2
0
ファイル: index.js プロジェクト: captainsafia/jupyter-paths
/**
 * dataDirs returns all the expected static directories for this OS.
 * The user of this function should make sure to make sure the directories
 * exist.
 *
 * When withSysPrefix is set, this returns a promise of directories
 *
 * @param  {bool} withSysPrefix include the sys.prefix paths
 * @return {Array} All the Jupyter Data Dirs
 */
function dataDirs(opts) {
  var paths = [];
  if (process.env.JUPYTER_PATH) {
    paths.push(process.env.JUPYTER_PATH);
  }

  paths.push(userDataDir());

  if (opts && opts.withSysPrefix) {
    return sysPrefixPromise()
            .then(sysPrefix => path.join(sysPrefix, 'share', 'jupyter'))
            .then(sysPathed => {
              const systemDirs = systemDataDirs();
              if (systemDirs.indexOf(sysPathed) === -1) {
                paths.push(sysPathed);
              }
              return paths.concat(systemDataDirs());
            });
  }
  return paths.concat(systemDataDirs());
}