Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1commit 6a72fd032405515e468797be91b5a6ebcbbb5fd8 2Author: Evils <evils.devils@protonmail.com> 3Date: Wed Nov 23 19:49:13 2022 +0100 4 5 ensure new projects are writable 6 7diff --git a/kicad/kicad_manager_frame.cpp b/kicad/kicad_manager_frame.cpp 8index 7ee8090858..391514519c 100644 9--- a/kicad/kicad_manager_frame.cpp 10+++ b/kicad/kicad_manager_frame.cpp 11@@ -638,6 +638,12 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxFileName& aProjectFileName, 12 13 // wxFFile dtor will close the file 14 } 15+ 16+ if( destFileName.IsOk() && !destFileName.IsFileWritable() ) 17+ { 18+ destFileName.SetPermissions(0644); 19+ } 20+ 21 } 22 } 23 24diff --git a/kicad/project_template.cpp b/kicad/project_template.cpp 25index bf951fcddb..2bef94326b 100644 26--- a/kicad/project_template.cpp 27+++ b/kicad/project_template.cpp 28@@ -282,6 +282,21 @@ bool PROJECT_TEMPLATE::CreateProject( wxFileName& aNewProjectPath, wxString* aEr 29 30 result = false; 31 } 32+ else if( !destFile.IsFileWritable() && !destFile.SetPermissions(0644) ) 33+ { 34+ if( aErrorMsg ) 35+ { 36+ if( !aErrorMsg->empty() ) 37+ *aErrorMsg += "\n"; 38+ 39+ wxString msg; 40+ 41+ msg.Printf( _( "Cannot make file writable: '%s'." ), destFile.GetFullPath() ); 42+ *aErrorMsg += msg; 43+ } 44+ 45+ result = false; 46+ } 47 } 48 49 return result;