Skip to content

Commit

Permalink
Add header/source
Browse files Browse the repository at this point in the history
  • Loading branch information
gcasa committed Nov 20, 2024
1 parent 34161bf commit 3d032b4
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
7 changes: 7 additions & 0 deletions XCode/PBXFileSystemSynchronizedRootGroup.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#import <Foundation/Foundation.h>

// Local includes
#import "PBXGroup.h"

@interface PBXFileSystemSynchronizedRootGroup : PBXGroup
@end
76 changes: 76 additions & 0 deletions XCode/PBXFileSystemSynchronizedRootGroup.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
Copyright (C) 2018, 2019, 2020, 2021 Free Software Foundation, Inc.
Written by: Gregory John Casamento <[email protected]>
Date: 2024 November
This file is part of the GNUstep XCode Library
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110 USA.
*/

#import "PBXCommon.h"
#import "PBXFileSystemSynchronizedRootGroup.h"
#import "PBXFileReference.h"
#import "PBXBuildFile.h"

@implementation PBXFileSystemSynchronizedRootGroup

- (NSMutableArray *) synchronizedChildren
{
NSFileManager *fm = [NSFileManager defaultManager];
BOOL isDirectory;
NSMutableArray *result = [NSMutableArray array];

if ([fm fileExistsAtPath: _path isDirectory: &isDirectory]
&& isDirectory == YES)
{
NSError *error = nil;
NSArray *files = [fm contentsOfDirectoryAtPath: _path error: &error];

if (error == nil)
{
NSEnumerator *en = [files objectEnumerator];
NSString *path = nil;

while ((path = [en nextObject]) != nil)
{
PBXBuildFile *buildFile = [[PBXBuildFile alloc] init];
PBXFileReference *fileRef = [[PBXFileReference alloc] initWithPath: path];

AUTORELEASE(buildFile);
AUTORELEASE(fileRef);

[buildFile setFileRef: fileRef];
[result addObject: buildFile];
}
}
}

return result;
}

- (instancetype) init
{
self = [super init];
if (self != nil)
{
[self setChildren: [self synchronizedChildren]];
}
return self;
}

@end

0 comments on commit 3d032b4

Please sign in to comment.