- NSArray *paths = [resourceDir stringsByAppendingPaths:
- [NSArray arrayWithObjects:
- @"site-lisp", @"lisp", @"leim", nil]];
- NSEnumerator *pathEnum = [paths objectEnumerator];
- resourcePaths = @"";
- while (resourcePath = [pathEnum nextObject])
- {
- if ([fileManager fileExistsAtPath: resourcePath isDirectory: &isDir])
- if (isDir)
- {
- if ([resourcePaths length] > 0)
- resourcePaths
- = [resourcePaths stringByAppendingString: pathSeparator];
- resourcePaths
- = [resourcePaths stringByAppendingString: resourcePath];
- }
- }
- if ([resourcePaths length] > 0)
- setenv ("EMACSLOADPATH", [resourcePaths UTF8String], 1);
-/*NSLog (@"loadPath: '%@'\n", resourcePaths); */
- }
-
- /* Normally, Emacs does not add its own bin/ directory to the PATH.
- However, a self-contained NS build has a different layout, with
- bin/ and libexec/ subdirectories in the directory that contains
- Emacs.app itself.
- We put libexec first, because init_callproc_1 uses the first
- element to initialize exec-directory. An alternative would be
- for init_callproc to check for invocation-directory/libexec. */
- if (!getenv ("EMACSPATH"))
- {
- NSArray *paths = [binDir stringsByAppendingPaths:
- [NSArray arrayWithObjects: @"libexec",
- @"bin", nil]];
- NSEnumerator *pathEnum = [paths objectEnumerator];
- resourcePaths = @"";
- while (resourcePath = [pathEnum nextObject])
- {
- if ([fileManager fileExistsAtPath: resourcePath isDirectory: &isDir])
- if (isDir)
- {
- if ([resourcePaths length] > 0)
- resourcePaths
- = [resourcePaths stringByAppendingString: pathSeparator];
- resourcePaths
- = [resourcePaths stringByAppendingString: resourcePath];
- }
- }
- if ([resourcePaths length] > 0)
- setenv ("EMACSPATH", [resourcePaths UTF8String], 1);