mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-02-22 03:01:27 +00:00
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@5815 72102866-910b-0410-8b05-ffd578937521
219 lines
6.9 KiB
Objective-C
219 lines
6.9 KiB
Objective-C
/* GSWProjectBundle.m - GSWeb: Class GSWProjectBundle
|
|
Copyright (C) 1999 Free Software Foundation, Inc.
|
|
|
|
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
|
Date: Mar 1999
|
|
|
|
This file is part of the GNUstep Web Library.
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Library 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
|
|
Library General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
License along with this library; if not, write to the Free
|
|
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
*/
|
|
|
|
static char rcsId[] = "$Id$";
|
|
|
|
#include <gsweb/GSWeb.framework/GSWeb.h>
|
|
#include <Foundation/NSFileManager.h>
|
|
|
|
|
|
|
|
//====================================================================
|
|
@implementation GSWProjectBundle
|
|
|
|
-(id)initWithPath:(NSString*)path_
|
|
{
|
|
LOGObjectFnStart();
|
|
if ((self=[super initWithPath:path_]))
|
|
{
|
|
//TODO
|
|
};
|
|
LOGObjectFnStop();
|
|
return nil;
|
|
};
|
|
|
|
//--------------------------------------------------------------------
|
|
-(void)dealloc
|
|
{
|
|
DESTROY(projectName);
|
|
DESTROY(subprojects);
|
|
DESTROY(pbProjectDictionary);
|
|
[super dealloc];
|
|
};
|
|
|
|
//--------------------------------------------------------------------
|
|
-(NSString*)description
|
|
{
|
|
return [NSString stringWithFormat:@"<%s %p - bundlePath:[%@] relativePaths:[%@] projectName:[%@] subprojects:[%@] pbProjectDictionary:[%@]>",
|
|
object_get_class_name(self),
|
|
(void*)self,
|
|
bundlePath,
|
|
relativePathsCache,
|
|
projectName,
|
|
subprojects,
|
|
pbProjectDictionary];
|
|
};
|
|
|
|
//--------------------------------------------------------------------
|
|
-(NSString*)lockedPathsForResourcesOfType:(id)type_
|
|
{
|
|
LOGObjectFnNotImplemented(); //TODOFN
|
|
return [super lockedPathsForResourcesOfType:type_];
|
|
};
|
|
|
|
//--------------------------------------------------------------------
|
|
-(NSString*)lockedPathsForResourcesInSubprojectsOfType:(id)type_
|
|
{
|
|
LOGObjectFnNotImplemented(); //TODOFN
|
|
return nil;
|
|
};
|
|
|
|
//--------------------------------------------------------------------
|
|
-(NSString*)lockedRelativePathForResourceNamed:(NSString*)name_
|
|
forLanguage:(NSString*)language_
|
|
{
|
|
LOGObjectFnNotImplemented(); //TODOFN
|
|
return [super lockedRelativePathForResourceNamed:name_
|
|
forLanguage:language_];
|
|
};
|
|
|
|
//--------------------------------------------------------------------
|
|
-(NSString*)lockedRelativePathForResourceNamed:(NSString*)name_
|
|
forLanguages:(NSArray*)languages_
|
|
{
|
|
LOGObjectFnNotImplemented(); //TODOFN
|
|
return [super lockedRelativePathForResourceNamed:name_
|
|
forLanguages:languages_];
|
|
};
|
|
|
|
//--------------------------------------------------------------------
|
|
-(NSDictionary*)subprojects
|
|
{
|
|
return subprojects;
|
|
};
|
|
|
|
//--------------------------------------------------------------------
|
|
-(BOOL)isFramework
|
|
{
|
|
LOGObjectFnNotImplemented(); //TODOFN
|
|
return NO;
|
|
};
|
|
|
|
//--------------------------------------------------------------------
|
|
-(GSWDeployedBundle*)projectBundle
|
|
{
|
|
LOGObjectFnNotImplemented(); //TODOFN
|
|
return [super projectBundle];
|
|
};
|
|
|
|
//--------------------------------------------------------------------
|
|
-(NSString*)projectPath
|
|
{
|
|
LOGObjectFnNotImplemented(); //TODOFN
|
|
return nil;
|
|
};
|
|
|
|
//--------------------------------------------------------------------
|
|
-(NSString*)projectName
|
|
{
|
|
return projectName;
|
|
};
|
|
|
|
//--------------------------------------------------------------------
|
|
-(NSDictionary*)_pbProjectDictionary
|
|
{
|
|
return pbProjectDictionary;
|
|
};
|
|
|
|
@end
|
|
|
|
//====================================================================
|
|
@implementation GSWProjectBundle (GSWProjectBundle)
|
|
+(GSWDeployedBundle*)projectBundleForProjectNamed:(NSString*)name_
|
|
isFramework:(BOOL)isFramework_
|
|
{
|
|
//OK
|
|
//name:ObjCTest3
|
|
GSWDeployedBundle* _projectBundle=nil;
|
|
GSWDeployedBundle* _aBundle=nil;
|
|
NSArray* _projectSearchPath=nil;
|
|
NSMutableArray* _projectsBundles=nil;
|
|
NSEnumerator* _projectEnum = nil;
|
|
NSEnumerator* _projectSearchPathEnum=nil;
|
|
NSString* _path=nil;
|
|
NSString* _suffix=isFramework_ ? GSFrameworkPSuffix : GSWApplicationPSuffix;
|
|
LOGClassFnStart();
|
|
NSDebugMLLog(@"bundles",@"name_:%@",name_);
|
|
NSDebugMLLog(@"bundles",@"isFramework_=%s",(isFramework_ ? "YES" : "NO"));
|
|
NSDebugMLLog(@"bundles",@"_suffix:%@",_suffix);
|
|
|
|
_projectSearchPath=[GSWApplication projectSearchPath]; // ("H:\\Wotests")
|
|
NSDebugMLLog(@"bundles",@"_projectSearchPath:%@",_projectSearchPath);
|
|
_projectsBundles=[NSMutableArray array];
|
|
|
|
_projectSearchPathEnum = [_projectSearchPath objectEnumerator];
|
|
while ((_path = [_projectSearchPathEnum nextObject]))
|
|
{
|
|
NSDirectoryEnumerator* dirEnum=nil;
|
|
NSString* filePath=nil;
|
|
NSFileManager* fileManager=[NSFileManager defaultManager];
|
|
dirEnum = [fileManager enumeratorAtPath:_path];
|
|
while ((filePath = [dirEnum nextObject]))
|
|
{
|
|
NSDictionary* attributes = [dirEnum fileAttributes];
|
|
NSString* fileType = [attributes objectForKey:NSFileType];
|
|
filePath=[_path stringByAppendingFormat:@"/%@",filePath];
|
|
NSDebugMLLog(@"bundles",@"filePath:%@",filePath);
|
|
// NSDebugMLLog(@"bundles",@"attributes:%@",attributes);
|
|
// NSDebugMLLog(@"bundles",@"fileType:%@",fileType);
|
|
if ([fileType isEqual:NSFileTypeDirectory])
|
|
{
|
|
BOOL _tmpBundleIsFramework=NO;
|
|
NSString* _tmpBundleProjectName=nil;
|
|
GSWDeployedBundle* _tmpBundle=[GSWProjectBundle bundleWithPath:filePath];
|
|
NSDebugMLLog(@"bundles",@"_tmpBundle:%@",_tmpBundle);
|
|
_tmpBundleProjectName=[_tmpBundle projectName];
|
|
NSDebugMLLog(@"bundles",@"_tmpBundleProjectName:%@",_tmpBundleProjectName);
|
|
_tmpBundleIsFramework=[_tmpBundle isFramework];
|
|
NSDebugMLLog(@"bundles",@"_tmpBundleIsFramework=%s",(_tmpBundleIsFramework ? "YES" : "NO"));
|
|
//Why projectName...
|
|
if ((isFramework_ && _tmpBundleIsFramework)
|
|
||(!isFramework_ && !_tmpBundleIsFramework))
|
|
{
|
|
NSDebugMLLog(@"bundles",@"adding _tmpBundle:%@",_tmpBundleProjectName);
|
|
[_projectsBundles addObject:_tmpBundle];
|
|
};
|
|
};
|
|
};
|
|
};
|
|
_projectEnum =[_projectsBundles objectEnumerator];
|
|
while(!_projectBundle && (_aBundle = [_projectEnum nextObject]))
|
|
{
|
|
NSDebugMLLog(@"bundles",@"_aBundle:%@",_aBundle);
|
|
if ([[_aBundle bundlePath]hasSuffix:_suffix] || [[_aBundle bundlePath]hasSuffix:@".debug"])
|
|
{
|
|
NSString* _tmpName=[_aBundle projectName];
|
|
NSDebugMLLog(@"bundles",@"_tmpName:%@",_tmpName);
|
|
if ([_tmpName isEqual:name_])
|
|
{
|
|
_projectBundle=_aBundle;
|
|
NSDebugMLLog(@"bundles",@"_projectBundle:%@",_projectBundle);
|
|
};
|
|
};
|
|
};
|
|
NSDebugMLLog(@"bundles",@"_projectBundle:%@",_projectBundle);
|
|
LOGClassFnStop();
|
|
return _projectBundle;
|
|
};
|
|
|
|
@end
|