Skip to content

Commit

Permalink
fixed java code execution, now i'll consume bit more resource (config…
Browse files Browse the repository at this point in the history
…ured for some innocent creatures!! )
  • Loading branch information
Hunter87ff committed Aug 17, 2024
1 parent d4844ed commit 395058b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 10 deletions.
31 changes: 26 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,45 @@ dry-runner extension is a tool that allows you to compile and run C,C++, Python,

## Installation
1. Open VS code Extension section
2. Search "dry-runner" from the search bar
3. click on dry runner extension
3. click on install
2. Search "dry-runner" from the search bar and install
3. After successful installation you can customise executable path here!!
3. Well You've done installation


## Usage
1. Open a supported file in your VS Code.
2. To run just click F5
1. Configure path if not configure. if you don't have admin perms to your system, you can also configure path here
2. Open a supported file in your VS Code.
2. To run just click F5(you can change through settings)
3. You've Done


## Default Shortcut Key
- F5 : Start
- F5 : Restart
- F4 : Stop and close terminal


## Configuration
You can customize the behavior of the dry-runner extension by modifying the settings. To access the settings, go to the preferences menu of your code editor and search for "dry-runner".



## Don't have permission to change executable(AKA environment) path?
1. You can download portable version of the program executables (only if no executable is already exist)
2. Then extract the portable (zip,7z,rar...)
3. Copy the bin path of the executable
4. Paste the path to the extension settings -> executable path (jdk,mingw,python, node, php etc.)
5. Restart vs code!! and done!!



## Portables (Be Cautious!! )
- Mingw64 : [Mingw](https://github.com/jonasstrandstedt/MinGW)
- JDK-17.0.1 : [JDK-22](https://www.oracle.com/java/technologies/javase/jdk22-archive-downloads.html)
- Python :
- Node :
- PHP :

## Contributing
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the dry-runner GitHub repository.

Expand Down
7 changes: 4 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ export function activate(context: vscode.ExtensionContext) {
if (path.includes("node")) {paths["node"] = path; }
if (path.includes("php")) {paths["php"] = path; }
});
const divider = utils.getDivider();
const prefix = divider === "&&"? null:"& ";
const config = vscode.workspace.getConfiguration('dry-runner'); //package.json
const mingwpath = config.get('mingwPath') || paths.mingw as string;
const javapath = config.get('jdkPath') || paths.java as string;
Expand All @@ -36,6 +34,9 @@ export function activate(context: vscode.ExtensionContext) {
let terminal: vscode.Terminal | undefined;

function getCommand(document:vscode.TextDocument){
const divider = utils.getDivider();
const prefix = divider === "&&"? null:"& ";

let dir = dirname(document.fileName);
let ext = extname(document.fileName).toString();
let noExt = basename(document.fileName, extname(document.fileName)).replace(" ", "_")
Expand All @@ -51,7 +52,7 @@ export function activate(context: vscode.ExtensionContext) {
let runCmd: { [key: string]: string } = {
".c" : `"${binPath.c}" "${dir}\\${basename(document.fileName)}" -o "${dir}\\${noExt}" ${divider} ${dir}\\${noExt}`,
".cpp" : `"${binPath.cpp}" "${dir}\\${basename(document.fileName)}" -o "${dir}\\${noExt}" ${divider} "${dir}\\${noExt}"`,
".java": `"cd ${dir} ${divider} ${binPath.javac}" "${basename(document.fileName)}" ${divider} "${binPath.java}" "${basename(document.fileName)}"`,
".java": `cd "${dir}" ${divider} "${binPath.javac}" "${basename(document.fileName)}" ${divider} "${binPath.java}" "${basename(document.fileName).replace(".java","")}"`,
".py" : `"${binPath.py}" "${dir}\\${basename(document.fileName)}"`,
".js" : `"${binPath.js}" "${dir}\\${basename(document.fileName)}"`,
".php" : `"${binPath.php}" "${dir}\\${basename(document.fileName)}"`,
Expand Down
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import * as vscode from "vscode";
export function getDefaultTerminalType(): string | undefined {
const platform = process.platform;
let defaultProfileSetting = '';
if (platform === 'win32') {defaultProfileSetting = 'terminal.integrated.defaultProfile.windows';}
if (platform.includes('win32')) {defaultProfileSetting = 'terminal.integrated.defaultProfile.windows';}
else if (platform === 'linux') {defaultProfileSetting = 'terminal.integrated.defaultProfile.linux';}
else if (platform === 'darwin') {defaultProfileSetting = 'terminal.integrated.defaultProfile.osx';}
const defaultProfile = vscode.workspace.getConfiguration().get<string>(defaultProfileSetting);
if (defaultProfile) {return defaultProfile.toLowerCase();}
return undefined;
return "cmd";
}

export function getDivider(): string {
Expand Down

0 comments on commit 395058b

Please sign in to comment.