Skip to content

Commit

Permalink
fix: problem getting file paths and symlinks
Browse files Browse the repository at this point in the history
  • Loading branch information
Cody Zuschlag committed Sep 14, 2016
1 parent e95cab8 commit 76bcbec
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/utils/style-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Dependencies
var minimatch = require('minimatch')
var pkgConfig = require('pkg-config')
var fs = require('fs')

module.exports = function checkStyleSettings (filePath) {
// Default value
Expand All @@ -11,14 +12,9 @@ module.exports = function checkStyleSettings (filePath) {
// NOTE: the project's path returned will be
// from the nearest package.json (direction upward)
try {
var projectPath
var activeTextEditorPath = fs.realpathSync(atom.workspace.getActiveTextEditor().getPath())
var projectPaths = atom.project.getPaths()
var projectPathCount = projectPaths.length
for (var i = 0; i < projectPathCount; i++) {
if (atom.workspace.getActiveTextEditor().getPath().indexOf(projectPaths[i]) >= 0) {
projectPath = projectPaths[i]
}
}
var projectPath = projectPaths.find((p) => activeTextEditorPath.indexOf(fs.realpathSync(p)) >= 0)
if (!projectPath) {
return atom.notifications.addWarning('Could not get the file path.', {
detail: 'No sweat, just save this file and this annoying warning shouldn\'t appear anymore',
Expand Down

0 comments on commit 76bcbec

Please sign in to comment.