Tildify path in title bar

This will use ~/ for the path to the home directory
This commit is contained in:
Lukas Geiger
2016-08-31 20:47:09 +01:00
parent bb0b0857f4
commit 498a56a603
3 changed files with 12 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
_ = require 'underscore-plus'
path = require 'path'
fs = require 'fs-plus'
Grim = require 'grim'
{CompositeDisposable, Emitter} = require 'event-kit'
{Point, Range} = TextBuffer = require 'text-buffer'
@@ -803,12 +804,13 @@ class TextEditor extends Model
allPathSegments = []
for textEditor in atom.workspace.getTextEditors() when textEditor isnt this
if textEditor.getFileName() is fileName
allPathSegments.push(textEditor.getDirectoryPath().split(path.sep))
directoryPath = fs.tildify(textEditor.getDirectoryPath())
allPathSegments.push(directoryPath.split(path.sep))
if allPathSegments.length is 0
return fileName
ourPathSegments = @getDirectoryPath().split(path.sep)
ourPathSegments = fs.tildify(@getDirectoryPath()).split(path.sep)
allPathSegments.push ourPathSegments
loop