Skip to content

Commit

Permalink
version upgrade! fixed path issue for linux, changed configuration fo…
Browse files Browse the repository at this point in the history
…r windows
  • Loading branch information
Hunter87ff committed Apr 13, 2024
1 parent 0695e6e commit f42458d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
Binary file modified img/installation.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion img/log.txt

This file was deleted.

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": "dry-runner",
"displayName": "C/C+ Runner",
"description": "Run C/C++ code in one click.",
"version": "1.0.2",
"version": "1.0.3",
"publisher": "Spruce87",
"author": {
"name": "hunter87"
Expand Down
16 changes: 6 additions & 10 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let stopDisposable: vscode.Disposable;
let runDisposable: vscode.Disposable;
let restartDisposable: vscode.Disposable;


// C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command g++ "d:\Codes\testing\dsa\queue.cpp" -o "d:\Codes\testing\dsa\queue.exe"; d:\Codes\testing\dsa\queue.exe
export function activate(context: vscode.ExtensionContext) {
const config = vscode.workspace.getConfiguration('dry-runner'); //package.json
const compilerPath = config.get('compilerPath') as string;
Expand All @@ -16,6 +16,7 @@ export function activate(context: vscode.ExtensionContext) {
const outlog = (message: string) => outputChannel.appendLine(message);
const errlog = (message: string) => vscode.window.showErrorMessage(message);
const isWin = process.platform === 'win32';
if(isWin){vscode.workspace.getConfiguration().update('terminal.integrated.shell.windows', 'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe', vscode.ConfigurationTarget.Global);}
let terminal: vscode.Terminal | undefined;
let compiler:string;
let c_compiler:string;
Expand Down Expand Up @@ -48,10 +49,10 @@ export function activate(context: vscode.ExtensionContext) {
if(document?.languageId==='c'){compiler = c_compiler;}
else if (document?.languageId==='cpp'){compiler = cpp_compiler;}
if(isWin){
terminal.sendText(`${compiler} "${fileDirectory}\\${fileBaseName}" -o "${fileDirectory}\\${fileBaseNameWithoutExt}.exe"; ${fileDirectory}\\${fileBaseNameWithoutExt}.exe`);
terminal.sendText(`powershell -Command ${compiler} "${fileDirectory}\\${fileBaseName}" -o "${fileDirectory}\\${fileBaseNameWithoutExt}.exe"; ${fileDirectory.replace(/\\/g, "/")}/${fileBaseNameWithoutExt}.exe`);
}
else{
terminal.sendText(`${compiler} "${fileBaseName}" -o "${fileBaseNameWithoutExt}.exe"; ./${fileBaseNameWithoutExt}.exe`);
terminal.sendText(`${compiler} "${fileDirectory}\\${fileBaseName}" -o "${fileDirectory}\\${fileBaseNameWithoutExt}.exe"; ${fileDirectory}\\${fileBaseNameWithoutExt}.exe`);
}
terminal.show();
}
Expand All @@ -63,20 +64,15 @@ export function activate(context: vscode.ExtensionContext) {
terminal?.dispose();});

restartDisposable = vscode.commands.registerCommand("dry-runner.restart", async () => {
terminal?.dispose();run();
terminal?.dispose();
run();
});

context.subscriptions.push(runDisposable);
context.subscriptions.push(stopDisposable);
context.subscriptions.push(restartDisposable);
}

vscode.window.onDidCloseTerminal(t => {
if (t.exitStatus && t.exitStatus.code) {
vscode.window.showInformationMessage(`Exit code: ${t.exitStatus.code}`);
}
});

export function deactivate() {
stopDisposable.dispose();
runDisposable.dispose();
Expand Down

0 comments on commit f42458d

Please sign in to comment.