relative path management added

This commit is contained in:
Damien Caro 2017-12-30 23:58:42 -08:00
Родитель 2f052c8f65
Коммит 5578416bef
2 изменённых файлов: 13 добавлений и 6 удалений

Просмотреть файл

@ -88,7 +88,8 @@ export class CloudShell extends BaseShell {
await delay (retry_interval);
} else {
try {
this.csTerm.ws.send('rm ' + path.basename(file) + ' \n');
this.csTerm.ws.send('rm ' + path.relative(vscode.workspace.rootPath, file) + ' \n');
// TODO: Add directory management
}
catch (err) {
console.log(err)
@ -165,18 +166,22 @@ export class CloudShell extends BaseShell {
if (this.csTerm.ws.readyState != ws.OPEN ){
await delay (retry_interval);
} else {
for (let file of TFFiles.map( a => a.fileName)) {
for (let file of TFFiles.map( a => a.fsPath)) {
try {
if (fsExtra.existsSync(file)) {
const data = fsExtra.readFileSync(file, { encoding: 'utf8' }).toString();
this.csTerm.ws.send('echo -e "' + escapeFile(data) + '" > ' + path.basename(file) + ' \n');
vscode.window.showInformationMessage(`Uploaded all the text files in the current workspace to CloudShell`);
console.log(`Uploading file ${file} to cloud shell as ${path.relative(vscode.workspace.rootPath, file)}`)
const data = fsExtra.readFileSync(file, { encoding: 'utf8' }).toString();
// this.csTerm.ws.send('mkdir -p ' + path.relative(vscode.workspace.rootPath, path.dirname(file)) + ' \n');
this.csTerm.ws.send('mkdir -p ' + path.relative(vscode.workspace.rootPath, path.dirname(file))
+ ' && ' +
'echo -e "' + escapeFile(data) + '" > ./' + path.relative(vscode.workspace.rootPath, file) + ' \n');
}
}
catch (err) {
console.log(err)
}
}
vscode.window.showInformationMessage(`Uploaded all the text files in the current workspace to CloudShell`);
break;
}
}

Просмотреть файл

@ -103,7 +103,9 @@ export function activate(ctx: vscode.ExtensionContext) {
else {
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-terraform-azure.push', () => {
// Create a function that will sync the files to Cloudshell
activeShell.copyTerraformFiles(vscode.workspace.textDocuments);
vscode.workspace.findFiles('**/*.tf').then(TFfiles => {
activeShell.copyTerraformFiles(TFfiles);
});
}));
}