]> err.no Git - sope/commitdiff
use new OGoResourceLocator in NGObjWeb
authorhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Thu, 23 Sep 2004 14:46:38 +0000 (14:46 +0000)
committerhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Thu, 23 Sep 2004 14:46:38 +0000 (14:46 +0000)
git-svn-id: http://svn.opengroupware.org/SOPE/trunk@164 e4a50df8-12e2-0310-a44c-efbce7f8a7e3

sope-appserver/NGObjWeb/ChangeLog
sope-appserver/NGObjWeb/Version
sope-appserver/NGObjWeb/WOCoreApplication.m
sope-core/NGExtensions/NGResourceLocator.m

index 123f19cc1c7714b56bc7ea651c3584abcc90f615..161bd92aecb5fbf4d8ecd86acbf1828750d4b271 100644 (file)
@@ -1,3 +1,8 @@
+2004-09-23  Helge Hess  <helge.hess@skyrix.com>
+       
+       * WOCoreApplication.m: use NGResourceLocator to determine search pathes
+         (v4.3.42)
+       
 2004-09-22  Marcus Mueller  <znek@mulle-kybernetik.com>
 
        * NGObjWeb.xcode: added WOServerDefaults.m to the build
index 903192e4aa6eee0ea45beac3420bbf255b6f35da..d3b8ad7c19db96581b75540b3d0aaded78dafc24 100644 (file)
@@ -1,7 +1,8 @@
 # version file
 
-SUBMINOR_VERSION:=41
+SUBMINOR_VERSION:=42
 
+# v4.3.42  requires libNGExtensions v4.3.116
 # v4.3.40  requires libNGExtensions v4.3.115
 # v4.2.413 requires libSaxObjC      v4.2.33
 # v4.2.341 requires libNGExtensions v4.2.77
index 7245a1a35a84aefcb3de662fe4005591bb4f7c13..145fe2f39896ccd4a91c6232ce6691e4dfada1c0 100644 (file)
@@ -28,6 +28,7 @@
 #include <EOControl/EOControl.h>
 #include <NGStreams/NGStreams.h>
 #include <NGStreams/NGNet.h>
+#include <NGExtensions/NGResourceLocator.h>
 #include "WORunLoop.h"
 #include "common.h"
 
@@ -687,66 +688,36 @@ static NSMutableArray *activeApps = nil; // THREAD
 
 /* defaults */
 
-+ (NSArray *)resourcesSearchPathes {
-  NSMutableArray *ma;
-  NSDictionary   *env;
-  NSString       *relPath, *apath;
-  NSEnumerator   *e;
-  
-  ma  = [NSMutableArray arrayWithCapacity:8];
-  env = [[NSProcessInfo processInfo] environment];
++ (int)sopeMajorVersion {
+  return SOPE_MAJOR_VERSION;
+}
++ (int)sopeMinorVersion {
+  return SOPE_MINOR_VERSION;
+}
++ (NSString *)ngobjwebShareDirectorySubPath {
+  return [NSString stringWithFormat:@"share/sope-%i.%i/ngobjweb/",
+                     [self sopeMajorVersion], [self sopeMinorVersion]];
+}
++ (NGResourceLocator *)ngobjwebResourceLocator {
+  return [NGResourceLocator resourceLocatorForGNUstepPath:
+                              @"Library/Libraries/Resources/NGObjWeb"
+                            fhsPath:[self ngobjwebShareDirectorySubPath]];
+}
 
-  /* 
-     TODO: the following is a dirty hack because GNUstep people decided
-           to change the directory structure. SIGH!
-  */
-  relPath = @"Library/Libraries";
-  relPath = [relPath stringByAppendingPathComponent:@"Resources"];
-  relPath = [relPath stringByAppendingPathComponent:@"NGObjWeb"];
-  
-  if ((apath = [env objectForKey:@"GNUSTEP_PATHPREFIX_LIST"]) == nil)
-    apath = [env objectForKey:@"GNUSTEP_PATHLIST"];
-  
-  e = [[apath componentsSeparatedByString:@":"] objectEnumerator];
-  while ((apath = [e nextObject])) {
-    apath = [apath stringByAppendingPathComponent:relPath];
-    if ([ma containsObject:apath]) continue;
-    
-    [ma addObject:apath];
-  }
-  [ma addObject:relPath];
-  
-  relPath = [NSString stringWithFormat:@"share/sope-%i.%i/ngobjweb/",
-                        SOPE_MAJOR_VERSION, SOPE_MINOR_VERSION];
-  [ma addObject:[@"/usr/local/" stringByAppendingString:relPath]];
-  [ma addObject:[@"/usr/"       stringByAppendingString:relPath]];
-  return ma;
++ (NSArray *)resourcesSearchPathes {
+  // TODO: is this actually used somewhere?
+  return [[self ngobjwebResourceLocator] searchPathes];
 }
 
 + (NSString *)findNGObjWebResource:(NSString *)_name ofType:(NSString *)_ext {
-#if !COMPILE_AS_FRAMEWORK
-  NSFileManager *fm;
-  NSString      *filename;
-#else
+#if COMPILE_AS_FRAMEWORK
   NSBundle *bundle;
-#endif
-  NSEnumerator  *e;
-  NSString      *apath;
   
-#if COMPILE_AS_FRAMEWORK
   bundle = [NSBundle bundleForClass:[WOCoreApplication class]];
   return [bundle pathForResource:_name ofType:_ext];
 #else
-  filename = [_name stringByAppendingPathExtension:_ext];
-  fm       = [NSFileManager defaultManager];
-  e        = [[self resourcesSearchPathes] objectEnumerator];
-  while ((apath = [e nextObject]) != nil) {
-    apath = [apath stringByAppendingPathComponent:filename];
-    
-    if ([fm fileExistsAtPath:apath])
-      return apath;
-  }
-  return nil;
+  return [[self ngobjwebResourceLocator] lookupFileWithName:_name 
+                                         extension:_ext];
 #endif
 }
 
@@ -760,7 +731,7 @@ static NSMutableArray *activeApps = nil; // THREAD
   
   apath = [self findNGObjWebResource:@"Defaults" ofType:@"plist"];
   if (apath == nil)
-    NSLog(@"ERROR: cannot find Defaults.plist resource of NGObjWeb library !");
+    NSLog(@"ERROR: cannot find Defaults.plist resource of NGObjWeb library!");
   
   owDefaults = [NSDictionary dictionaryWithContentsOfFile:apath];
   if (owDefaults) {
index 5e5a29a658632e070faf75eec6d05ce92d2b1807..21afdc69a154f87f100256bca3dbdaaf4b951108 100644 (file)
 }
 
 - (NSString *)lookupFileWithName:(NSString *)_name extension:(NSString *)_ext {
-  return [self lookupFileWithName:[_name stringByAppendingPathExtension:_ext]];
+  if ([_ext isNotNull] && [_ext length] > 0)
+    _name = [_name stringByAppendingPathExtension:_ext];
+  return [self lookupFileWithName:_name];
 }
 
 @end /* NGResourceLocator */