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

Commit

Permalink
兼容linux路径
Browse files Browse the repository at this point in the history
  • Loading branch information
super1207 committed Oct 28, 2023
1 parent e8afcd9 commit 62e7339
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
cross build --target i686-unknown-linux-musl --release
cross build --target armv7-unknown-linux-musleabi --release
cross build --target aarch64-linux-android --release
cross build --target x86_64-linux-android --release
- name: before_upload
run: |
Expand All @@ -44,6 +45,7 @@ jobs:
cp target/i686-unknown-linux-musl/release/kook_onebot Release/kook_onebot_linux_i686
cp target/armv7-unknown-linux-musleabi/release/kook_onebot Release/kook_onebot_linux_armv7
cp target/aarch64-linux-android/release/kook_onebot Release/kook_onebot_android_aarch64
cp target/x86_64-linux-android/release/kook_onebot Release/kook_onebot_android_x86_64
- name: upload file1
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -79,3 +81,10 @@ jobs:
name: kook_onebot_android_aarch64
path:
Release/kook_onebot_android_aarch64

- name: upload file file6
uses: actions/upload-artifact@v3
with:
name: kook_onebot_android_x86_64
path:
Release/kook_onebot_android_x86_64
8 changes: 6 additions & 2 deletions src/kook_onebot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,13 @@ impl KookOnebot {
file_bin = base64::Engine::decode(&base64::engine::GeneralPurpose::new(
&base64::alphabet::STANDARD,
base64::engine::general_purpose::PAD), b64_str)?;

}else {
let file_path = uri.get(8..).ok_or("can't get file_path")?;
let file_path;
if cfg!(target_os = "linux") {
file_path = uri.get(7..).ok_or("can't get file_path")?;
} else {
file_path = uri.get(8..).ok_or("can't get file_path")?;
}
let path = Path::new(&file_path);
file_bin = tokio::fs::read(path).await?;
}
Expand Down

0 comments on commit 62e7339

Please sign in to comment.