Skip to content

Commit a5a6029

Browse files
committed
use node path module
1 parent 1fc33df commit a5a6029

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

src/features/linter-provider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import * as path from 'path';
44
import * as cp from 'child_process';
55
import ChildProcess = cp.ChildProcess;
6-
import { getIncludeParams, LANGUAGE_ID, extract_path } from '../lib/helper';
6+
import { getIncludeParams, LANGUAGE_ID } from '../lib/helper';
77

88
import * as vscode from 'vscode';
99

@@ -29,7 +29,7 @@ export default class FortranLintingProvider {
2929
let command = this.getGfortranPath();
3030
let argList = this.constructArgumentList(textDocument);
3131

32-
let filePath = extract_path(textDocument.fileName);
32+
let filePath = path.parse(textDocument.fileName).dir;
3333
let childProcess = cp.spawn(command, argList, {cwd: filePath});
3434

3535
if (childProcess.pid) {

src/lib/helper.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

22
import * as fs from 'fs';
33
import * as vscode from 'vscode';
4-
let path = require('path');
5-
const fileSep = path.sep;
4+
5+
66

77
export const LANGUAGE_ID = 'fortran90';
88

@@ -109,8 +109,3 @@ let saveKeywordToJson = (keyword) => {
109109
});
110110
};
111111

112-
export const extract_path = (file: string) => {
113-
114-
let pos = file.lastIndexOf(fileSep);
115-
return file.substring(0, pos);
116-
};

0 commit comments

Comments
 (0)