Skip to content

Commit 6d03291

Browse files
committed
s3 ready
1 parent 6f9b45e commit 6d03291

File tree

9 files changed

+15
-31
lines changed

9 files changed

+15
-31
lines changed

.DS_Store

0 Bytes
Binary file not shown.

aws_s3_cloud_drive/.DS_Store

6 KB
Binary file not shown.

aws_s3_cloud_drive/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ before-packaging-command = "cargo build --release"
2424
name = "GenUI Cloud Drive"
2525
authors = ["Will Sheng <syf20020816@outlook.com>"]
2626
identifier = "com.privoce"
27-
icon = ["./resources/32x32.jpg", "./resources/128x128.jpg"]
27+
icons = ["./resources/32x32.jpg", "./resources/128x128.jpg"]
2828
version = "0.0.1"
2929
resources = [
3030
{ src = "./dist/resources/makepad_widgets", target = "makepad_widgets" },

aws_s3_cloud_drive/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
A simple AWS S3 cloud storage client written using Rust Makepad framework
44

5+
> [!IMPORTANT]
6+
> **Chinese Mainland needs to ensure access to AWS services**
7+
58
## Prepare
69

710
For installation instructions, expand the section for your operating system.
-11.9 KB
Binary file not shown.
4.02 KB
Loading
File renamed without changes.

aws_s3_cloud_drive/src/utils/commands.rs

+2-26
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::{
2-
env::current_dir,
2+
env::current_exe,
33
fs::{File, OpenOptions},
44
io::{Read, Write},
55
path::PathBuf,
@@ -234,7 +234,7 @@ pub fn remove_virtual(target: &str) -> Result<Vec<String>, std::io::Error> {
234234
}
235235

236236
pub fn read_or_create(target: &str) -> std::io::Result<File> {
237-
let current_path = current_dir().unwrap();
237+
let current_path = current_exe().unwrap();
238238
let conf_path = current_path.join(target);
239239
OpenOptions::new()
240240
.create(true)
@@ -246,27 +246,3 @@ pub fn read_or_create(target: &str) -> std::io::Result<File> {
246246
pub fn format_s3_path(path: &Vec<String>) -> String {
247247
format!("s3://{}/", path.join("/"))
248248
}
249-
250-
#[cfg(test)]
251-
mod t {
252-
#[test]
253-
fn test_ls() {
254-
// let results = super::ls();
255-
// dbg!(results.unwrap());
256-
// assert!(results.is_ok());
257-
}
258-
#[test]
259-
fn test_ls_dir() {
260-
let results = super::ls_dir("yarddesign");
261-
dbg!(results.unwrap());
262-
}
263-
// #[test]
264-
// fn test_cp() {
265-
// let results = super::cp(
266-
// r#"E:\pratice_imgs\makepad_taobao-main.zip"#,
267-
// "s3://yarddesign/pratice_imgs/",
268-
// true,
269-
// ).await?;
270-
// dbg!(results);
271-
// }
272-
}

aws_s3_cloud_drive/src/utils/state.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,18 @@ pub struct State {
3535
}
3636

3737
#[derive(Debug, Clone, Default, PartialEq, Eq)]
38-
pub enum Req{
38+
pub enum Req {
3939
#[default]
4040
None,
4141
Upload,
4242
Rm,
4343
Cp,
4444
Mv,
4545
Share,
46-
Error(String)
46+
Error(String),
4747
}
4848

49-
impl Req{
49+
impl Req {
5050
pub fn is_none(&self) -> bool {
5151
matches!(self, Req::None)
5252
}
@@ -297,7 +297,12 @@ impl State {
297297
self.msg = String::from_utf8_lossy(&out.stderr.as_slice()).to_string();
298298
}
299299
}
300-
Err(e) => self.msg = e.to_string(),
300+
Err(e) => {
301+
// write to ./log
302+
// let mut f = read_or_create("log").expect("Can not create log file!");
303+
// let _ = f.write(format!("{}\n", e).as_bytes());
304+
self.msg = e.to_string();
305+
}
301306
}
302307
return None;
303308
};

0 commit comments

Comments
 (0)