nativescript
Version:
Command-line interface for building NativeScript projects
57 lines • 2.34 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.IOSSimulatorFileSystem = void 0;
const path = require("path");
const shelljs = require("shelljs");
const _ = require("lodash");
class IOSSimulatorFileSystem {
constructor(iosSim, $fs, $logger) {
this.iosSim = iosSim;
this.$fs = $fs;
this.$logger = $logger;
}
async listFiles(devicePath) {
return this.iosSim.listFiles(devicePath);
}
async getFile(deviceFilePath, appIdentifier, outputFilePath) {
if (outputFilePath) {
shelljs.cp("-f", deviceFilePath, outputFilePath);
}
}
async getFileContent(deviceFilePath, appIdentifier) {
const result = this.$fs.readText(deviceFilePath);
return result;
}
async putFile(localFilePath, deviceFilePath, appIdentifier) {
shelljs.cp("-f", localFilePath, deviceFilePath);
}
async deleteFile(deviceFilePath, appIdentifier) {
shelljs.rm("-rf", deviceFilePath);
}
async transferFiles(deviceAppData, localToDevicePaths) {
await Promise.all(_.map(localToDevicePaths, (localToDevicePathData) => this.transferFile(localToDevicePathData.getLocalPath(), localToDevicePathData.getDevicePath())));
return localToDevicePaths;
}
async transferDirectory(deviceAppData, localToDevicePaths, projectFilesPath) {
const destinationPath = await deviceAppData.getDeviceProjectRootPath();
this.$logger.trace(`Transferring from ${projectFilesPath} to ${destinationPath}`);
const sourcePath = path.join(projectFilesPath, "*");
shelljs.cp("-Rf", sourcePath, destinationPath);
return localToDevicePaths;
}
async transferFile(localFilePath, deviceFilePath) {
this.$logger.trace(`Transferring from ${localFilePath} to ${deviceFilePath}`);
if (this.$fs.getFsStats(localFilePath).isDirectory()) {
this.$fs.ensureDirectoryExists(deviceFilePath);
}
else {
this.$fs.ensureDirectoryExists(path.dirname(deviceFilePath));
shelljs.cp("-f", localFilePath, deviceFilePath);
}
}
updateHashesOnDevice(hashes, appIdentifier) {
return;
}
}
exports.IOSSimulatorFileSystem = IOSSimulatorFileSystem;
//# sourceMappingURL=ios-simulator-file-system.js.map
;