This repository has been archived by the owner on Oct 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
LaoLittle
committed
Nov 13, 2022
1 parent
b6f64f7
commit e033127
Showing
4 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use std::path::PathBuf; | ||
use atri_ffi::RustString; | ||
use tracing::error; | ||
use crate::plugin::cast_ref; | ||
use crate::service::plugin_manager::PluginManager; | ||
|
||
pub extern "C" fn env_get_workspace(handle: usize, manager: *const ()) -> RustString { | ||
let manager: &PluginManager = cast_ref(manager); | ||
manager.find_plugin(handle) | ||
.map(|p| { | ||
let name = p.name(); | ||
let mut path = std::env::current_dir() | ||
.ok() | ||
.and_then(|p| p.to_str().map(|str| { | ||
let mut p = String::from(str); | ||
p.push('/'); | ||
p | ||
})) | ||
.unwrap_or_else(String::new); | ||
|
||
path.push_str("workspaces/"); | ||
path.push_str(name); | ||
|
||
if let Err(e) = std::fs::create_dir_all(&path) { | ||
error!("为{}创建Workspace失败: {}", p, e); | ||
} | ||
|
||
path | ||
}) | ||
.unwrap_or_else(String::new) | ||
.into() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters