mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
use absolute path (#6483)
This commit is contained in:
@@ -17,7 +17,7 @@ const localize = nls.loadMessageBundle();
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
const platformService = new PlatformService();
|
||||
const toolsService = new ToolsService();
|
||||
const notebookService = new NotebookService(platformService);
|
||||
const notebookService = new NotebookService(platformService, context.extensionPath);
|
||||
const resourceTypeService = new ResourceTypeService(platformService, toolsService);
|
||||
|
||||
const resourceTypes = resourceTypeService.getResourceTypes();
|
||||
|
||||
@@ -19,7 +19,7 @@ export interface INotebookService {
|
||||
|
||||
export class NotebookService implements INotebookService {
|
||||
|
||||
constructor(private platformService: IPlatformService) { }
|
||||
constructor(private platformService: IPlatformService, private extensionPath: string) { }
|
||||
|
||||
/**
|
||||
* Copy the notebook to the user's home directory and launch the notebook from there.
|
||||
@@ -27,7 +27,7 @@ export class NotebookService implements INotebookService {
|
||||
*/
|
||||
launchNotebook(notebook: string | NotebookInfo): void {
|
||||
const notebookRelativePath = this.getNotebook(notebook);
|
||||
const notebookFullPath = path.join(__dirname, '../../', notebookRelativePath);
|
||||
const notebookFullPath = path.join(this.extensionPath, notebookRelativePath);
|
||||
if (notebookRelativePath && this.platformService.fileExists(notebookFullPath)) {
|
||||
this.showNotebookAsUntitled(notebookFullPath);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ suite('Notebook Service Tests', function (): void {
|
||||
|
||||
test('getNotebook with string parameter', () => {
|
||||
const mockPlatformService = TypeMoq.Mock.ofType<IPlatformService>();
|
||||
const notebookService = new NotebookService(mockPlatformService.object);
|
||||
const notebookService = new NotebookService(mockPlatformService.object, '');
|
||||
const notebookInput = 'test-notebook.ipynb';
|
||||
mockPlatformService.setup((service) => service.platform()).returns(() => { return 'win32'; });
|
||||
let returnValue = notebookService.getNotebook(notebookInput);
|
||||
@@ -32,7 +32,7 @@ suite('Notebook Service Tests', function (): void {
|
||||
|
||||
test('getNotebook with NotebookInfo parameter', () => {
|
||||
const mockPlatformService = TypeMoq.Mock.ofType<IPlatformService>();
|
||||
const notebookService = new NotebookService(mockPlatformService.object);
|
||||
const notebookService = new NotebookService(mockPlatformService.object, '');
|
||||
const notebookWin32 = 'test-notebook-win32.ipynb';
|
||||
const notebookDarwin = 'test-notebook-darwin.ipynb';
|
||||
const notebookLinux = 'test-notebook-linux.ipynb';
|
||||
@@ -62,7 +62,7 @@ suite('Notebook Service Tests', function (): void {
|
||||
|
||||
test('findNextUntitledEditorName with no name conflict', () => {
|
||||
const mockPlatformService = TypeMoq.Mock.ofType<IPlatformService>();
|
||||
const notebookService = new NotebookService(mockPlatformService.object);
|
||||
const notebookService = new NotebookService(mockPlatformService.object, '');
|
||||
const notebookFileName = 'mynotebook.ipynb';
|
||||
const sourceNotebookPath = `./notebooks/${notebookFileName}`;
|
||||
|
||||
@@ -76,7 +76,7 @@ suite('Notebook Service Tests', function (): void {
|
||||
|
||||
test('findNextUntitledEditorName with name conflicts', () => {
|
||||
const mockPlatformService = TypeMoq.Mock.ofType<IPlatformService>();
|
||||
const notebookService = new NotebookService(mockPlatformService.object);
|
||||
const notebookService = new NotebookService(mockPlatformService.object, '');
|
||||
const notebookFileName = 'mynotebook.ipynb';
|
||||
const sourceNotebookPath = `./notebooks/${notebookFileName}`;
|
||||
const expectedFileName = 'mynotebook-2';
|
||||
|
||||
Reference in New Issue
Block a user