Skip to content

Commit 69198b2

Browse files
committed
Working on AddFolder/Groups
1 parent 8d6984f commit 69198b2

File tree

5 files changed

+298
-69
lines changed

5 files changed

+298
-69
lines changed

PBXDictionary.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class PBXDictionary : Dictionary<string, object>
99

1010
}
1111

12-
public class PBXDictionary<T> : Dictionary<string, T>
12+
public class PBXDictionary<T> : Dictionary<string, T> where T : PBXObject
1313
{
1414
public PBXDictionary()
1515
{
@@ -25,5 +25,10 @@ public PBXDictionary( PBXDictionary genericDictionary )
2525
}
2626
}
2727
}
28+
29+
public void AddObject( T newObject )
30+
{
31+
this.Add( newObject.guid, newObject );
32+
}
2833
}
2934
}

PBXFileReference.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,16 @@ public PBXFileReference( string filePath, TreeEnum tree = TreeEnum.SOURCE_ROOT )
8181
this.Add( PATH_KEY, filePath );
8282
this.Add( NAME_KEY, System.IO.Path.GetFileName( filePath ) );
8383
this.Add( SOURCETREE_KEY, (string)( System.IO.Path.IsPathRooted( filePath ) ? trees[TreeEnum.ABSOLUTE] : trees[tree] ) );
84-
Debug.Log( "constructorX" );
8584
this.GuessFileType();
8685
}
8786

8887
private void GuessFileType()
8988
{
90-
Debug.Log( "constructor1" );
9189
this.Remove( EXPLICIT_FILE_TYPE_KEY );
92-
Debug.Log( "constructor2" );
9390
this.Remove( LASTKNOWN_FILE_TYPE_KEY );
94-
Debug.Log( "constructor3" );
9591
string extension = System.IO.Path.GetExtension( (string)this[ PATH_KEY ] );
96-
Debug.Log( "constructor4 " + extension );
9792
this.Add( LASTKNOWN_FILE_TYPE_KEY, PBXFileReference.typeNames[ extension ] );
98-
Debug.Log( "constructor5" );
9993
this.buildPhase = PBXFileReference.typePhases[ extension ];
100-
Debug.Log( "constructor6" );
10194
}
10295

10396
private void SetFileType( string fileType )

XCBuildConfiguration.cs

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,54 @@ namespace UnityEditor.XCodeEditor
66
public class XCBuildConfiguration : PBXObject
77
{
88
protected const string BUILDSETTINGS_KEY = "buildSettings";
9-
protected const string HEADER_SEARCH_PATH_KEY = "HEADER_SEARCH_PATH";
10-
protected const string LIBRARY_SEARCH_PATH_KEY = "LIBRARY_SEARCH_PATH";
9+
protected const string HEADER_SEARCH_PATHS_KEY = "HEADER_SEARCH_PATHS";
10+
protected const string LIBRARY_SEARCH_PATHS_KEY = "LIBRARY_SEARCH_PATHS";
1111
protected const string OTHER_C_FLAGS_KEY = "OTHER_CFLAGS";
1212

13-
public bool AddSearchPaths( string path, string basePath, string key, bool recursive = true )
13+
public XCBuildConfiguration( string guid, PBXDictionary dictionary ) : base( guid, dictionary )
14+
{
15+
16+
}
17+
18+
public PBXDictionary buildSettings {
19+
get {
20+
if( ContainsKey( BUILDSETTINGS_KEY ) )
21+
return (PBXDictionary)this[BUILDSETTINGS_KEY];
22+
23+
Debug.Log( "strano" );
24+
return null;
25+
}
26+
}
27+
28+
protected bool AddSearchPaths( string path, string key, bool recursive = true )
1429
{
1530
PBXList paths = new PBXList();
1631
paths.Add( path );
17-
return AddSearchPaths( paths, basePath, key, recursive );
32+
return AddSearchPaths( paths, key, recursive );
1833
}
1934

20-
public bool AddSearchPaths( PBXList paths, string basePath, string key, bool recursive = true )
21-
{
35+
protected bool AddSearchPaths( PBXList paths, string key, bool recursive = true )
36+
{
2237
bool modified = false;
2338

24-
if( !ContainsKey( basePath ) )
25-
this.Add( basePath, new PBXDictionary() );
39+
if( !ContainsKey( BUILDSETTINGS_KEY ) )
40+
this.Add( BUILDSETTINGS_KEY, new PBXDictionary() );
2641

2742
foreach( string path in paths ) {
2843
string currentPath = path;
2944
if( recursive && !path.EndsWith( "/**" ) )
3045
currentPath += "**";
3146

32-
if( !((PBXDictionary)this[basePath]).ContainsKey( key ) ) {
33-
((PBXDictionary)this[basePath]).Add( key, new PBXList() );
47+
if( !((PBXDictionary)this[BUILDSETTINGS_KEY]).ContainsKey( key ) ) {
48+
((PBXDictionary)this[BUILDSETTINGS_KEY]).Add( key, new PBXList() );
3449
}
35-
else if( ((PBXDictionary)this[basePath])[key] is string ) {
50+
else if( ((PBXDictionary)this[BUILDSETTINGS_KEY])[key] is string ) {
3651
PBXList list = new PBXList();
37-
list.Add( ((PBXDictionary)this[basePath])[key] );
38-
((PBXDictionary)this[basePath])[key] = list;
52+
list.Add( ((PBXDictionary)this[BUILDSETTINGS_KEY])[key] );
53+
((PBXDictionary)this[BUILDSETTINGS_KEY])[key] = list;
3954
}
4055

41-
if( ((PBXList)((PBXDictionary)this[basePath])[key]).Add( "\"" + currentPath + "\"" ) >= 0 ) {
56+
if( ((PBXList)((PBXDictionary)this[BUILDSETTINGS_KEY])[key]).Add( "\"" + currentPath + "\"" ) >= 0 ) {
4257
modified = true;
4358
}
4459
}
@@ -48,23 +63,26 @@ public bool AddSearchPaths( PBXList paths, string basePath, string key, bool rec
4863

4964
public bool AddHeaderSearchPaths( PBXList paths, bool recursive = true )
5065
{
51-
return this.AddSearchPaths( paths, "buildSettings", "HEADER_SEARCH_PATHS", recursive );
66+
return this.AddSearchPaths( paths, HEADER_SEARCH_PATHS_KEY, recursive );
5267
}
5368

54-
public bool AddLibrarySearchPath( PBXList paths, bool recursive = true )
69+
public bool AddLibrarySearchPaths( PBXList paths, bool recursive = true )
5570
{
56-
return this.AddSearchPaths( paths, "buildSettings", "LIBRARY_SEARCH_PATHS", recursive );
71+
return this.AddSearchPaths( paths, LIBRARY_SEARCH_PATHS_KEY, recursive );
5772
}
5873

5974
public bool AddOtherCFlags( string flag )
6075
{
76+
Debug.Log( "INIZIO 1" );
6177
PBXList flags = new PBXList();
6278
flags.Add( flag );
6379
return AddOtherCFlags( flags );
6480
}
6581

6682
public bool AddOtherCFlags( PBXList flags )
6783
{
84+
Debug.Log( "INIZIO 2" );
85+
6886
bool modified = false;
6987

7088
if( !ContainsKey( BUILDSETTINGS_KEY ) )

0 commit comments

Comments
 (0)