Skip to content

Commit

Permalink
Fix #273: Could not run file without extension
Browse files Browse the repository at this point in the history
  • Loading branch information
formulahendry committed Mar 19, 2018
1 parent f87971d commit 9ce19bf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 0.9.3 (2018-03-19)
* [#273](https://github.com/formulahendry/vscode-code-runner/issues/273): Could not run file without extension

### 0.9.2 (2018-03-13)
* Add $pythonPath customized parameter to respect `python.pythonPath` setting

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "code-runner",
"displayName": "Code Runner",
"description": "Run C, C++, Java, JS, PHP, Python, Perl, Ruby, Go, Lua, Groovy, PowerShell, CMD, BASH, F#, C#, VBScript, TypeScript, CoffeeScript, Scala, Swift, Julia, Crystal, OCaml, R, AppleScript, Elixir, VB.NET, Clojure, Haxe, Objective-C, Rust, Racket, AutoHotkey, AutoIt, Kotlin, Dart, Pascal, Haskell, Nim, D",
"version": "0.9.2",
"version": "0.9.3",
"publisher": "formulahendry",
"icon": "images/logo.png",
"engines": {
Expand Down
6 changes: 3 additions & 3 deletions src/codeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,23 +288,23 @@ export class CodeManager implements vscode.Disposable {
*/
private getCodeBaseFile(): string {
const regexMatch = this._codeFile.match(/.*[\/\\](.*)/);
return regexMatch.length ? regexMatch[1] : this._codeFile;
return regexMatch ? regexMatch[1] : this._codeFile;
}

/**
* Gets the code file name without its directory and extension.
*/
private getCodeFileWithoutDirAndExt(): string {
const regexMatch = this._codeFile.match(/.*[\/\\](.*(?=\..*))/);
return regexMatch.length ? regexMatch[1] : this._codeFile;
return regexMatch ? regexMatch[1] : this._codeFile;
}

/**
* Gets the directory of the code file.
*/
private getCodeFileDir(): string {
const regexMatch = this._codeFile.match(/(.*[\/\\]).*/);
return regexMatch.length ? regexMatch[1] : this._codeFile;
return regexMatch ? regexMatch[1] : this._codeFile;
}

/**
Expand Down

0 comments on commit 9ce19bf

Please sign in to comment.