diff --git a/README.md b/README.md index 3abcd93..f71080d 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/src/extension.ts b/src/extension.ts index 724aacf..e98b25c 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -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; @@ -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(" ", "_") @@ -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)}"`, diff --git a/src/utils.ts b/src/utils.ts index 170d5b3..3961b9b 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -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(defaultProfileSetting); if (defaultProfile) {return defaultProfile.toLowerCase();} - return undefined; + return "cmd"; } export function getDivider(): string {