Skip to content

Commit

Permalink
Merge pull request #3 from TabulateJarl8/fix_windows
Browse files Browse the repository at this point in the history
Fix windows
  • Loading branch information
TabulateJarl8 authored Feb 24, 2022
2 parents 3173dd0 + dad1126 commit 6d54645
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/target
/dist
3 changes: 1 addition & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
[package]
name = "wordle_finder"
version = "2.2.2"
version = "2.2.3"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
atty = "0.2.14"
clap = "3.0.14"
regex = "1.5.4"
serde = { version = "1.0.136", features = ["derive"] }
Expand Down
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.PHONY: all

all: linux windows-x64

pre-build:
mkdir -p dist/

linux: pre-build
cargo build --release
cp -f ./target/release/wordle_finder ./dist/wordle_finder
strip ./dist/wordle_finder

windows-x64: pre-build
cargo build --target x86_64-pc-windows-gnu --release
strip ./target/x86_64-pc-windows-gnu/release/wordle_finder.exe
cp -f ./winlib/WebView2Loader_x64.dll ./target/x86_64-pc-windows-gnu/release/build/WebView2Loader.dll
rm -f ./dist/windows_x64.zip
zip -rj \
./dist/windows_x64.zip \
./target/x86_64-pc-windows-gnu/release/build/WebView2Loader.dll \
./target/x86_64-pc-windows-gnu/release/wordle_finder.exe \
LICENSE \
./winlib/WebView2LoaderDLL-LICENSE.txt \
README.md

clean:
rm -rf dist/
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# wordle-finder
# Wordle Finder
Rust program to help find the wordle word

## Use
This program can either be used from a terminal, `./wordle_finder --help` for more info, or with the GUI frontend, launched by running `./wordle_finder -g` in a terminal
This program can be used from a terminal, run `./wordle_finder --help` for more info. If you'd like to use the GUI frontend, you can launch it by running `./wordle_finder -g` in a terminal or opening the binary from a file explorer.

<details>
<summary>GUI Frontend for version 2.0.0</summary>
Expand All @@ -13,7 +13,13 @@ This program can either be used from a terminal, `./wordle_finder --help` for mo
I provide pre-built binaries on the releases page. I do not test the Windows binary, but it may work.

### Windows Users
If you get an error about `WebView2Loader.dll` missing, you need to download it from somewhere online and put it in the same directory as `wordle_finder.exe`. I personally found the one from [dll-files.com](https://www.dll-files.com/webview2loader.dll.html) to work, but I did this in a VM and am not sure of the actual integrity of the file.
If you launch the program by double clicking and it immediately closes, or you get an error similar to this: `thread 'main' panicked at 'Error when running GUI: WebView2Error(WindowsError(Error { code: 0x80070002, message: The system cannot find the file specified., win32_error: 2 }))'`, then you should try installing the WebView2 Runtime from the [Microsoft website](https://developer.microsoft.com/en-us/microsoft-edge/webview2/#download-section).

## Building
First, install rust using your package manager or from https://www.rust-lang.org/. After you have rust installed, download or clone the repository and then run `cargo build --release` in the repository folder. The binary should then be found at `./target/release/wordle_finder` or `./target/release/wordle_finder.exe` if you're on Windows.
First, install rust using your package manager or from https://www.rust-lang.org/.

#### Linux systems with make
Linux systems with make installed can make the project that way `make linux` or `make windows-x64` will make the respective binaries and output them in the `dist/` folder.

#### Other systems
Other systems can build the binary for their system by running `cargo build --release` in the repository folder. The resulting binary can be found at `./target/release/wordle_finder` or `./target/release/wordle_finder.exe` if you're on Windows.
5 changes: 3 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ fn main() {
.required(false))
.get_matches();

// run gui if specified or if not a tty (not running from a terminal)
if matches.is_present("gui") || !atty::is(atty::Stream::Stdout) {
// run gui if no args are specified (detecting a tty doesn't seem to work on windows)
// this should launch the GUI if run from a file explorer
if matches.is_present("gui") || std::env::args().len() == 1 {
match gui::run_gui() {
Err(error) => panic!("Error when running GUI: {:?}", error),
_ => (),
Expand Down
27 changes: 27 additions & 0 deletions winlib/WebView2LoaderDLL-LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright (C) Microsoft Corporation. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* The name of Microsoft Corporation, or the names of its contributors
may not be used to endorse or promote products derived from this
software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Binary file added winlib/WebView2Loader_x64.dll
Binary file not shown.

0 comments on commit 6d54645

Please sign in to comment.