File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
kic-script-gen/src/back_end Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ use std::path::Path;
1717
1818use super :: data_model:: DataModel ;
1919use crate :: back_end:: ipc_data:: IpcData ;
20+ use script_gen_manager:: model:: sweep_data:: status_msg:: { StatusMsg , StatusType } ;
2021
2122#[ derive( Serialize , Deserialize ) ]
2223pub struct ScriptPath {
@@ -77,17 +78,20 @@ impl AppState {
7778 // Check if the folder exists and is writable
7879
7980 if folder. exists ( ) {
80- let permissions = folder. metadata ( ) . map ( |m| m. permissions ( ) ) . unwrap ( ) ;
81- if permissions. readonly ( ) {
82- println ! ( "Cannot update work folder: folder is read-only" ) ;
83- return ;
84- }
8581 * work_folder_guard = Some ( path_file. to_string_lossy ( ) . to_string ( ) ) ;
8682 println ! ( "Work folder updated to: {work_folder_guard:?}" ) ;
8783 } else {
84+ let status_msg = StatusMsg :: new (
85+ StatusType :: Error ,
86+ format ! (
87+ "The folder is read-only (OR) Work folder does not exist: {:?}" ,
88+ path_file. to_string_lossy( ) . to_string( )
89+ ) ,
90+ ) ;
8891 println ! (
89- "Work folder does not exist: {:?}" ,
90- path_file. to_string_lossy( ) . to_string( )
92+ "{}" ,
93+ serde_json:: to_string( & status_msg)
94+ . unwrap_or_else( |_| status_msg. message. clone( ) )
9195 ) ;
9296 }
9397 } else {
You can’t perform that action at this time.
0 commit comments