helpers.js 376 B

1234567891011121314
  1. const path = require('path')
  2. module.exports = {
  3. repositoryForPath (filePath) {
  4. const paths = atom.project.getPaths()
  5. for (let i = 0; i < paths.length; i++) {
  6. const projectPath = paths[i]
  7. if ((filePath === projectPath) || filePath.startsWith(projectPath + path.sep)) {
  8. return atom.project.getRepositories()[i]
  9. }
  10. }
  11. return null
  12. }
  13. }