var path = require('path')
var fs = require('fs')

module.exports = function (dir1, dir2) {
  var expanded = path.resolve(dir1, dir2.replace(/\:/g, '/'))
  if (isDir(expanded)) {
    if (containsIndexFile(expanded)) {
      return expanded + '/index*'
    } else {
      return expanded + '/*'
    }
  } else {
    return expanded + '*'
  }
}

function isDir (f) {
  try {
    return fs.statSync(f).isDirectory()
  } catch (e) {}
}

function containsIndexFile (f) {
  try {
    return fs.statSync(f + '/index').isFile()
  } catch (e) {}
}

var path = require('path')
var fs = require('fs')

module.exports = function (dir1, dir2) {
  var expanded = path.resolve(dir1, path.join.apply(this, dir2.split(':')))
  if (isDir(expanded)) {
    if (containsIndexFile(expanded)) {
      return path.join(expanded, '/index') + '*'
    } else {
      return path.join(expanded, '/') + '*'
    }
  } else {
    return expanded + '*'
  }
}

function isDir (f) {
  try {
    return fs.statSync(f).isDirectory()
  } catch (e) {}
}

function containsIndexFile (f) {
  try {
    return fs.statSync(f + '/index').isFile()
  } catch (e) {}
}

Fix obvious forward-slashing that'll break windows
Fix obvious forward-slashing that'll break windows