You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122
  1. /*!
  2. * resolve-dir <https://github.com/jonschlinkert/resolve-dir>
  3. *
  4. * Copyright (c) 2015, Jon Schlinkert.
  5. * Licensed under the MIT License.
  6. */
  7. 'use strict';
  8. var path = require('path');
  9. var expand = require('expand-tilde');
  10. var gm = require('global-modules');
  11. module.exports = function resolveDir(dir) {
  12. if (dir.charAt(0) === '~') {
  13. dir = expand(dir);
  14. }
  15. if (dir.charAt(0) === '@') {
  16. dir = path.join(gm, dir.slice(1));
  17. }
  18. return dir;
  19. };