Skip to content

Commit

Permalink
fix: make getPackagesDirectory a free function
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Dec 31, 2020
1 parent d1061a2 commit b592149
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/minimap-plugin-generator-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class MinimapPluginGeneratorElement {
setPathText (placeholderName, rangeToSelect) {
if (!rangeToSelect) { rangeToSelect = [0, placeholderName.length] }

const packagesDirectory = this.getPackagesDirectory()
const packagesDirectory = getPackagesDirectory()

this.editor.setText(path.join(packagesDirectory, placeholderName))

Expand Down Expand Up @@ -112,12 +112,6 @@ class MinimapPluginGeneratorElement {
return path.join(path.dirname(packagePath), packageName)
}

getPackagesDirectory () {
return atom.config.get('core.projectHome') ||
process.env.ATOM_REPOS_HOME ||
path.join(getHomeDirectory(), 'github')
}

validPackagePath () {
if (existsSync(this.getPackagePath())) {
this.error.textContent = `Path already exists at '${this.getPackagePath()}'`
Expand Down Expand Up @@ -167,6 +161,12 @@ class MinimapPluginGeneratorElement {
const minimapPluginGeneratorElement = MinimapPluginGeneratorElement.initClass()
export default minimapPluginGeneratorElement

function getPackagesDirectory () {
return atom.config.get('core.projectHome') ||
process.env.ATOM_REPOS_HOME ||
path.join(getHomeDirectory(), 'github')
}

function isStoredInDotAtom (packagePath) {
const packagesPath = path.join(atom.getConfigDirPath(), 'packages', path.sep)
if (packagePath.indexOf(packagesPath) === 0) { return true }
Expand Down

0 comments on commit b592149

Please sign in to comment.