+
Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

release/beta-3 #30

Merged
merged 22 commits into from
Aug 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
bef92e7
chore: anchor regex to the start
casperstorm Aug 19, 2020
906fa7d
fix: sometimes zip failed to unpack
casperstorm Aug 19, 2020
8d70fb0
fix: handle case with multiple toc files
casperstorm Aug 19, 2020
68a9638
feat: parse single addon after download
casperstorm Aug 20, 2020
136dfa1
chore: cargo fmt
casperstorm Aug 20, 2020
f664444
chore: clippy
casperstorm Aug 20, 2020
22d8ed7
chore: refactor
casperstorm Aug 20, 2020
5ff6650
chore: fixed warning on windows
casperstorm Aug 20, 2020
6fc1681
chore: show loaded addons count
casperstorm Aug 20, 2020
777f628
feat: partial widows icon
casperstorm Aug 20, 2020
01c8306
feat: windows config location can now be next to exe
casperstorm Aug 21, 2020
fac892d
chore: optimization
casperstorm Aug 21, 2020
cc6a099
chore: removed wix dependency from the project for now
casperstorm Aug 21, 2020
ae781d5
Merge branch 'master' into release/beta-3
casperstorm Aug 21, 2020
d843b22
feat: separated scrollbar from scrollview
casperstorm Aug 21, 2020
8e0fbf0
chore: guard against empty dependencies
casperstorm Aug 21, 2020
88ea9f8
chore: gui enhancements
casperstorm Aug 21, 2020
29b4028
feat: new gh action
casperstorm Aug 21, 2020
4e3d32c
feat: added pull_request_template.md
casperstorm Aug 21, 2020
092efbc
fix: guard against race condition in refreshing addon list
casperstorm Aug 21, 2020
35b25c8
Merge branch 'release/beta-3' of github.com:casperstorm/ajour into re…
casperstorm Aug 21, 2020
29b4b0c
fix: guard against race condition when downloading and unpacking
casperstorm Aug 21, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/commit_to_pr_body.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
on:
pull_request:
types: [opened, synchronize]

name: Pull Request updated

jobs:
history:
name: Pull Request Body
runs-on: ubuntu-latest
if: startsWith(github.event.pull_request.head.ref, 'release/')
steps:
- name: Pull Request Body
uses: technote-space/pr-commit-body-action@v1
4 changes: 4 additions & 0 deletions .github/workflows/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Description

<!-- START pr-commits -->
<!-- END pr-commits -->
42 changes: 41 additions & 1 deletion Cargo.lock

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

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "ajour"
description = "A World of Warcraft addon manager"
version = "0.1.0-beta2"
version = "0.1.0-beta3"
authors = ["Casper Rogild Storm"]
license = "MIT"
homepage = "https://github.com/casperstorm/ajour"
Expand All @@ -20,3 +20,6 @@ serde_json = "1.0.57"
isahc = { version = "0.9.6", features = ["json"] }
zip = "0.5.6"
percent-encoding = "2.1.0"

[build-dependencies]
embed-resource = "1.3.3"
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ make app
make dmg

# Windows
cargo wix -I .\resources\windows\wix\main.wxs
cargo build --release
```

# Configuration
Expand All @@ -58,9 +58,11 @@ Ajour doesn't create the config file for you, but it looks for one in the follow

## Windows

On Windows, the config file should be located at:
On Windows, it looks for a config file in the following locations:

- `%APPDATA%\ajour\ajour.yml`
- `In the same directory as the executable`


# Screenshots

Expand Down
6 changes: 6 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
extern crate embed_resource;

fn main() {
#[cfg(windows)]
embed_resource::compile("resources/windows/res.rc");
}
3 changes: 3 additions & 0 deletions resources/windows/res.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#define IDI_ICON 0x101

IDI_ICON ICON "ajour.ico"
83 changes: 0 additions & 83 deletions resources/windows/wix/main.wxs

This file was deleted.

11 changes: 11 additions & 0 deletions src/addon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,17 @@ impl Addon {
dependencies
}

/// Takes a `Addon` and updates self.
/// Used when we reparse a single `Addon`.
pub fn update_addon(&mut self, other: &Addon) {
self.title = other.title.clone();
self.version = other.version.clone();
self.dependencies = other.dependencies.clone();
self.wowi_id = other.wowi_id.clone();
self.tukui_id = other.tukui_id.clone();
self.curse_id = other.curse_id;
}

/// Check if the `Addon` is updatable.
/// We strip both version for non digits, and then
/// checks if `remote_version` is a sub_slice of `local_version`.
Expand Down
20 changes: 18 additions & 2 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use serde_derive::Deserialize;
#[cfg(not(windows))]
use std::env;
use std::fs;
use std::path::PathBuf;
Expand Down Expand Up @@ -89,11 +90,26 @@ fn installed_config() -> Option<PathBuf> {
/// according to the following order:
///
/// 1. %APPDATA%\ajour\ajour.yml
/// 2. In the same directory as the executable
#[cfg(windows)]
fn installed_config() -> Option<PathBuf> {
dirs::config_dir()
let fallback = dirs::config_dir()
.map(|path| path.join("ajour\\ajour.yml"))
.filter(|new| new.exists())
.filter(|new| new.exists());
if let Some(fallback) = fallback {
return Some(fallback);
}

let fallback = std::env::current_exe();
if let Ok(fallback) = fallback.as_ref().map(|p| p.parent()) {
if let Some(fallback) = fallback.map(|f| f.join("ajour.yml")) {
if fallback.exists() {
return Some(fallback);
}
}
}

None
}

/// Returns the config after the content of the file
Expand Down
23 changes: 10 additions & 13 deletions src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,23 @@ pub async fn install_addon(
to_directory: &PathBuf,
) -> Result<()> {
let zip_path = from_directory.join(addon.id.clone());
// TODO: This sometimes fails: No such file or directory (os error 2).
let mut zip_file = std::fs::File::open(&zip_path)?;
let mut archive = zip::ZipArchive::new(&mut zip_file)?;

// TODO: Maybe remove old addon here, so we don't replace.

for i in 1..archive.len() {
for i in 0..archive.len() {
let mut file = archive.by_index(i)?;
let path = to_directory.join(file.sanitized_name());

if file.is_dir() {
std::fs::create_dir_all(path)?;
if (&*file.name()).ends_with('/') {
std::fs::create_dir_all(&path).unwrap();
} else {
let mut target = std::fs::OpenOptions::new()
.write(true)
.create(true)
.truncate(true)
.open(path)?;

std::io::copy(&mut file, &mut target)?;
if let Some(p) = path.parent() {
if !p.exists() {
std::fs::create_dir_all(&p).unwrap();
}
}
let mut outfile = std::fs::File::create(&path).unwrap();
std::io::copy(&mut file, &mut outfile).unwrap();
}
}

Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载