Skip to content

Commit

Permalink
fix(export-component): Windows 10 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Boris Litvinsky committed Nov 6, 2018
1 parent d5f434f commit 96f875c
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/file-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ import * as mkdirp from 'mkdirp';
import { sync as globSync } from 'glob';
import * as gitignoreToGlob from 'gitignore-to-glob';
import { workspaceRoot, activeURI } from './editor';
import * as lineColumn from 'line-column';
import * as prependFile from 'prepend-file';
import * as vscode from 'vscode';
import { SSL_OP_CISCO_ANYCONNECT } from 'constants';
import { Position, Uri } from 'vscode';

export function createFileIfDoesntExist(absolutePath: string): string {
Expand Down Expand Up @@ -43,15 +40,15 @@ export function filesInFolder(folder): string[] {

export function replaceTextInFile(text, start: vscode.Position, end: vscode.Position, path) {
const edit = new vscode.WorkspaceEdit();
edit.replace(vscode.Uri.parse(`file://${path}`), new vscode.Range(start, end), text);
edit.replace(Uri.file(path), new vscode.Range(start, end), text);
return vscode.workspace.applyEdit(edit);

}
export async function appendTextToFile(text, absolutePath) {
const edit = new vscode.WorkspaceEdit();
const linesInFile = await countLineInFile(absolutePath);

edit.insert(Uri.parse(`file://${absolutePath}`), new Position(linesInFile, 0), text);
edit.insert(Uri.file(absolutePath), new Position(linesInFile, 0), text);
return vscode.workspace.applyEdit(edit);

// return new Promise((resolve, reject) => {
Expand All @@ -65,7 +62,7 @@ export async function appendTextToFile(text, absolutePath) {

export function prependTextToFile(text, absolutePath) {
let edit = new vscode.WorkspaceEdit();
edit.insert(vscode.Uri.parse(`file://${absolutePath}`), new vscode.Position(0, 0), text);
edit.insert(Uri.file(absolutePath), new vscode.Position(0, 0), text);
return vscode.workspace.applyEdit(edit);
}

Expand Down

0 comments on commit 96f875c

Please sign in to comment.