mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-04-20 11:35:48 +00:00
feat: profile export static method to generate new uuid
This commit is contained in:
parent
93f5df9776
commit
14689e5358
1 changed files with 6 additions and 2 deletions
|
@ -248,7 +248,7 @@ impl Display for Profile {
|
|||
|
||||
impl Default for Profile {
|
||||
fn default() -> Self {
|
||||
let uuid = Uuid::new_v4().to_string();
|
||||
let uuid = Self::new_uuid();
|
||||
let profile_dir = get_data_dir().join(&uuid);
|
||||
Self {
|
||||
name: "Default profile name".into(),
|
||||
|
@ -362,10 +362,14 @@ impl Profile {
|
|||
serde_json::to_writer_pretty(writer, self).expect("Could not write profile")
|
||||
}
|
||||
|
||||
pub fn new_uuid() -> String {
|
||||
Uuid::new_v4().to_string()
|
||||
}
|
||||
|
||||
pub fn create_duplicate(&self) -> Self {
|
||||
if !self.can_be_built {
|
||||
let mut dup = self.clone();
|
||||
dup.uuid = Uuid::new_v4().to_string();
|
||||
dup.uuid = Self::new_uuid();
|
||||
dup.name = format!("Duplicate of {}", dup.name);
|
||||
dup.editable = true;
|
||||
return dup;
|
||||
|
|
Loading…
Add table
Reference in a new issue