File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ pub mod xcode;
1616/// Main presentation of XCodeProject
1717#[ derive( Debug , Default , derive_deref_rs:: Deref ) ]
1818pub struct XCodeProject {
19+ name : String ,
1920 root : PathBuf ,
2021 #[ deref]
2122 pbxproj : PBXRootObject ,
@@ -28,8 +29,30 @@ impl XCodeProject {
2829 let pbxproj_path = xcodeproj_folder. join ( "project.pbxproj" ) ;
2930
3031 Ok ( Self {
32+ name : xcodeproj_folder
33+ . file_name ( )
34+ . and_then ( |name| Some ( name. to_str ( ) ?. split_once ( "." ) ?. 0 . to_string ( ) ) )
35+ . unwrap ( ) ,
3136 root : xcodeproj_folder. parent ( ) . unwrap ( ) . to_path_buf ( ) ,
3237 pbxproj : pbxproj_path. try_into ( ) ?,
3338 } )
3439 }
40+
41+ /// Get a reference to the xcode project's name.
42+ #[ must_use]
43+ pub fn name ( & self ) -> & str {
44+ self . name . as_ref ( )
45+ }
46+
47+ /// Get a reference to the xcode project's root.
48+ #[ must_use]
49+ pub fn root ( & self ) -> & PathBuf {
50+ & self . root
51+ }
52+
53+ /// Get a reference to the xcode project's pbxproj.
54+ #[ must_use]
55+ pub fn pbxproj ( & self ) -> & PBXRootObject {
56+ & self . pbxproj
57+ }
3558}
You can’t perform that action at this time.
0 commit comments