"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const osHomedir = require("os-homedir");
const path = require("path");
function expandTilde(filepath) {
    const home = getHomedir();
    if (!isHomepath(filepath)) {
        return filepath;
    }
    return path.resolve(home, filepath.substr(2));
}
exports.default = expandTilde;
function getHomedir() {
    const home = osHomedir();
    if (!home)
        throw new Error('Could not find the homedir');
    return home;
}
function isHomepath(filepath) {
    return filepath.indexOf('~/') === 0 || filepath.indexOf('~\\') === 0;
}
exports.isHomepath = isHomepath;
//# sourceMappingURL=expandTilde.js.map