forked from StrafesNET/map-tool
Compare commits
1 Commits
script-upl
...
master
Author | SHA1 | Date | |
---|---|---|---|
d9a39cc046 |
18
src/main.rs
18
src/main.rs
@ -397,7 +397,7 @@ fn upload() -> AResult<()>{
|
|||||||
}
|
}
|
||||||
match upload_action {
|
match upload_action {
|
||||||
UploadAction::Upload(asset_id) => {
|
UploadAction::Upload(asset_id) => {
|
||||||
let status=std::process::Command::new("asset-tool")
|
let output=std::process::Command::new("asset-tool")
|
||||||
.args([
|
.args([
|
||||||
"upload-asset",
|
"upload-asset",
|
||||||
"--cookie-envvar","RBXCOOKIE",
|
"--cookie-envvar","RBXCOOKIE",
|
||||||
@ -405,16 +405,17 @@ fn upload() -> AResult<()>{
|
|||||||
])
|
])
|
||||||
.arg("--asset-id").arg(asset_id.to_string())
|
.arg("--asset-id").arg(asset_id.to_string())
|
||||||
.arg("--input-file").arg(file_thing.path().into_os_string().into_string().unwrap())
|
.arg("--input-file").arg(file_thing.path().into_os_string().into_string().unwrap())
|
||||||
.status()?;
|
.output()?;
|
||||||
match status.code() {
|
match output.status.code() {
|
||||||
Some(0)=>{
|
Some(0)=>{
|
||||||
//move file
|
//move file
|
||||||
let mut dest=PathBuf::from("maps/uploaded");
|
let mut dest=PathBuf::from("maps/uploaded");
|
||||||
dest.push(file_thing.file_name());
|
dest.push(file_thing.file_name());
|
||||||
std::fs::rename(file_thing.path(), dest)?;
|
std::fs::rename(file_thing.path(), dest)?;
|
||||||
}
|
}
|
||||||
Some(code)=>println!("upload failed! code={}",code),
|
other=>{
|
||||||
None => println!("no status code!"),
|
println!("upload failed! code={:?}\noutput={}\nerr={}",other,String::from_utf8_lossy(&output.stdout),String::from_utf8_lossy(&output.stderr));
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UploadAction::Skip => continue,
|
UploadAction::Skip => continue,
|
||||||
@ -436,9 +437,10 @@ fn upload() -> AResult<()>{
|
|||||||
let mut dest=PathBuf::from("maps/uploaded");
|
let mut dest=PathBuf::from("maps/uploaded");
|
||||||
dest.push(file_thing.file_name());
|
dest.push(file_thing.file_name());
|
||||||
std::fs::rename(file_thing.path(), dest)?;
|
std::fs::rename(file_thing.path(), dest)?;
|
||||||
}
|
},
|
||||||
Some(code)=>println!("upload failed! code={}",code),
|
other=>{
|
||||||
None => println!("no status code!"),
|
println!("upload failed! code={:?}\noutput={}\nerr={}",other,String::from_utf8_lossy(&output.stdout),String::from_utf8_lossy(&output.stderr));
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UploadAction::Delete => std::fs::remove_file(file_thing.path())?,
|
UploadAction::Delete => std::fs::remove_file(file_thing.path())?,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user