Skip to content
This repository has been archived by the owner on Apr 3, 2022. It is now read-only.

Commit

Permalink
Show window on deflection error
Browse files Browse the repository at this point in the history
  • Loading branch information
spikespaz committed Jul 2, 2018
1 parent 153c974 commit 3a5dd05
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion deflect.d
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import std.string: replace, indexOf, toLower, startsWith;
import std.array: split;
import std.stdio: writeln, readln;
import std.uri: decodeComponent, encodeComponent;
import core.sys.windows.winuser: ShowWindow, SW_SHOWDEFAULT;
import core.sys.windows.wincon: GetConsoleWindow;

// Function to run after setup, actually deflected.
void deflect(const string uri) {
Expand All @@ -18,7 +20,7 @@ void deflect(const string uri) {
const string searchQuery = getQueryParams(url)["pq"];
const string searchURL = "https://" ~ registryInfo["EngineURL"].replace("{{query}}", searchQuery);

openURI(registryInfo["BrowserPath"], searchURL);
openURI(registryInfo["BrowserPath"], searchURL);
} else if (checkHTTPURI(url))
openURI(registryInfo["BrowserPath"], url);
else
Expand All @@ -32,6 +34,8 @@ void deflectionError(const string uri) {
"Please submit a GitHub issue at https://github.com/spikespaz/search-deflector/issues.\n",
"Be sure to include the text below.\n\n", uri, "\n\nPress Enter to exit.");
readln();

ShowWindow(GetConsoleWindow(), SW_SHOWDEFAULT);
}

// Check if a URI is HTTP protocol.
Expand Down

0 comments on commit 3a5dd05

Please sign in to comment.