Notebook Code Cleanup + Utils Test (#11754)

* Cleanup + Utils Test

* Removing unnecessary util method
This commit is contained in:
Chris LaFreniere
2020-08-14 14:08:56 -07:00
committed by GitHub
parent ff2d2d0339
commit a34a72795b
8 changed files with 9 additions and 44 deletions

View File

@@ -9,7 +9,6 @@ import * as vscode from 'vscode';
import * as path from 'path';
import * as zip from 'adm-zip';
import * as tar from 'tar';
import * as utils from '../common/utils';
import { RemoteBook } from './remoteBook';
import { IAsset } from './remoteBookController';
import * as constants from '../common/constants';
@@ -76,7 +75,7 @@ export class GitHubRemoteBook extends RemoteBook {
}
public async extractFiles(remoteBookFullPath: vscode.Uri): Promise<void> {
try {
if (utils.getOSPlatform() === utils.Platform.Windows || utils.getOSPlatform() === utils.Platform.Mac) {
if (process.platform === constants.winPlatform || process.platform === constants.macPlatform) {
let zippedFile = new zip(remoteBookFullPath.fsPath);
zippedFile.extractAllTo(this._localPath.fsPath);
} else {

View File

@@ -5,11 +5,11 @@
import * as request from 'request';
import * as loc from '../common/localizedConstants';
import * as utils from '../common/utils';
import * as vscode from 'vscode';
import { RemoteBookDialogModel } from '../dialog/remoteBookDialogModel';
import { GitHubRemoteBook } from '../book/githubRemoteBook';
import { SharedRemoteBook } from '../book/sharedRemoteBook';
import { winPlatform, macPlatform } from '../common/constants';
const assetNameRE = /([a-zA-Z0-9]+)(?:-|_)([a-zA-Z0-9.]+)(?:-|_)([a-zA-Z0-9]+).(zip|tar.gz|tgz)/;
@@ -73,7 +73,7 @@ export class RemoteBookController {
public async getAssets(release?: IRelease): Promise<IAsset[]> {
if (release) {
let format: string[] = [];
if (utils.getOSPlatform() === utils.Platform.Windows || utils.getOSPlatform() === utils.Platform.Mac) {
if (process.platform === winPlatform || process.platform === macPlatform) {
format = ['zip'];
} else {
format = ['tar.gz', 'tgz'];