mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
resource deployment ext implementation -wip (#5508)
* resource types * implement the dialog * remove unused method * fix issues * formatting * 5-17 * address comments and more tests
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
/**
|
||||
* Abstract of platform dependencies
|
||||
*/
|
||||
export interface IPlatformService {
|
||||
platform(): string;
|
||||
copyFile(source: string, target: string): void;
|
||||
fileExists(file: string): boolean;
|
||||
openFile(filePath: string): void;
|
||||
showErrorMessage(message: string): void;
|
||||
}
|
||||
|
||||
export class PlatformService implements IPlatformService {
|
||||
platform(): string {
|
||||
return process.platform;
|
||||
}
|
||||
|
||||
copyFile(source: string, target: string): void {
|
||||
fs.copyFileSync(source, target);
|
||||
}
|
||||
|
||||
fileExists(file: string): boolean {
|
||||
return fs.existsSync(file);
|
||||
}
|
||||
|
||||
openFile(filePath: string): void {
|
||||
vscode.commands.executeCommand('vscode.open', vscode.Uri.file(filePath));
|
||||
}
|
||||
|
||||
showErrorMessage(message: string): void {
|
||||
vscode.window.showErrorMessage(message);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user