 
   # This function splits a path on `/` and removes any empty trailing element.
   ###
-  getPathParts = (path) ->
-    parts = path.split("/")
-    return parts.slice(0, parts.length - 1)  if parts[parts.length - 1] is ""
-    parts
+
 
   #<section id='makeNodes'/>
 


  constructor: (@name, @path, @json_data) ->
    @children = null

  @initRootNode = ->
    unless @_ROOT_NODE?
      @_NODES[@_ROOT_PATH] = @_ROOT_NODE = new RootFeedlyNode()

  @getNode = (path, callback) ->
    _console.debug "[feedlyconsole:FeedlyNode] looking for node at '%s'.", path
    @initRootNode()
    return callback @_ROOT_NODE unless path?
    return callback @_NODES[path] if path of @_NODES

    parts = getPathParts(path)
    # If the first part of path parts isn't empty, the path is a
    # relative path, which can be turned into an *absolutish* path
    # by pre-pending the parts of the current pathnode.
    parts = getPathParts(_self.pathhandler.current.path)
    .concat(parts)  if parts[0] isnt ""
    # At this point the path is *absolutish*, i.e. looks absolute, but
    # all `.` and `..` mentions need to removed and resolved before it
    # is truly absolute.
    resolved = []
    _.each parts, (x) ->
      return  if x is "."
      if x is ".."
        resolved.pop()
      else
        resolved.push x

    absolute = resolved.join("/")
    _console.debug "[Josh.FeedlyConsole]path to fetch: " + absolute
    # if get getDir returns false, use same node
    return getDir(absolute, callback) or self.node

  @getChildNodes = (node, callback) ->
    node.getChildNodes callback

  getChildNodes = (callback) ->
    # If the given node is a file node, no further work is required.
    if node.isFile
      _console.debug "[Josh.FeedlyConsole] it's a file, no children %O", node

      FeedlyNode._ROOT_PATH,
      { cmds: FeedlyNode._ROOT_COMMANDS }

  getChildNodes: (callback) ->
    @children ?= (new FeedlyNode(name,
      [@path, name].join('/'),
      null) for name in FeedlyNode._ROOT_COMMANDS)
    return callback @children

  toString: ->
    return "#{@name} '#{@path}'"

#//////////////////////////////////////////////////////////
# based on josh.js:gh-pages githubconsole
