mobile-cli-lib
Version:
common lib used by different CLI
39 lines (38 loc) • 1.8 kB
JavaScript
;
var helpers = require("../helpers");
var path = require("path");
var LocalToDevicePathData = (function () {
function LocalToDevicePathData(filePath, localProjectRootPath, onDeviceFileName, deviceProjectRootPath) {
this.filePath = filePath;
this.localProjectRootPath = localProjectRootPath;
this.onDeviceFileName = onDeviceFileName;
this.deviceProjectRootPath = deviceProjectRootPath;
}
LocalToDevicePathData.prototype.getLocalPath = function () {
return this.filePath;
};
LocalToDevicePathData.prototype.getDevicePath = function () {
if (!this.devicePath) {
var devicePath = path.join(this.deviceProjectRootPath, path.dirname(this.getRelativeToProjectBasePath()), this.onDeviceFileName);
this.devicePath = helpers.fromWindowsRelativePathToUnix(devicePath);
}
return this.devicePath;
};
LocalToDevicePathData.prototype.getRelativeToProjectBasePath = function () {
if (!this.relativeToProjectBasePath) {
this.relativeToProjectBasePath = path.relative(this.localProjectRootPath, this.filePath);
}
return this.relativeToProjectBasePath;
};
return LocalToDevicePathData;
}());
var LocalToDevicePathDataFactory = (function () {
function LocalToDevicePathDataFactory() {
}
LocalToDevicePathDataFactory.prototype.create = function (filePath, localProjectRootPath, onDeviceFileName, deviceProjectRootPath) {
return new LocalToDevicePathData(filePath, localProjectRootPath, onDeviceFileName, deviceProjectRootPath);
};
return LocalToDevicePathDataFactory;
}());
exports.LocalToDevicePathDataFactory = LocalToDevicePathDataFactory;
$injector.register("localToDevicePathDataFactory", LocalToDevicePathDataFactory);