bugfix source file location.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14471 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2002-09-17 09:22:45 +00:00
parent 28070f3673
commit d9a98baa47
3 changed files with 79 additions and 5 deletions

View file

@ -1,3 +1,8 @@
2002-09-16 Richard Frith-Macdonald <rfm@gnu.org>
* Tools/AGSParser.m: Bugfix ... look for source files more
intelligently. Try both current directory and relative to header.
2002-09-16 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSFileManager.m: Basic/dummy implementations of new MacOS-X

View file

@ -787,11 +787,31 @@ fail:
[source removeAllObjects];
if (isSource == NO)
{
NSFileManager *mgr = [NSFileManager defaultManager];
NSString *path;
[info setObject: fileName forKey: @"Header"];
[source removeAllObjects];
[source addObject:
[[[fileName lastPathComponent] stringByDeletingPathExtension]
stringByAppendingPathExtension: @"m"]];
/**
* We initially assume that the location of a source file is the
* same as the header, but if there is no file at that location,
* we expect the source to be in the current directory instead.
*/
path = [fileName stringByDeletingPathExtension];
path = [path stringByAppendingPathExtension: @"m"];
if ([mgr isReadableFileAtPath: path] == NO)
{
path = [path lastPathComponent];
if ([mgr isReadableFileAtPath: path] == NO)
{
path = nil; // No default source file found.
}
}
if (path != nil)
{
[source addObject: path];
}
}
unitName = nil;
itemName = nil;
@ -2617,7 +2637,51 @@ fail:
if ([line length] > 0
&& [source containsObject: line] == NO)
{
[source addObject: line];
NSFileManager *mgr;
/*
* See if the path given exists, and add it to
* the list of source files parsed for this
* header.
*/
mgr = [NSFileManager defaultManager];
if ([mgr isReadableFileAtPath: line] == NO)
{
if ([line isAbsolutePath] == YES)
{
[self log: @"AutogsdocSource: %@ not found!",
line];
line = nil;
}
else
{
NSString *p;
/*
* Try forming a path relative to the
* header file if the source file was not
* found in the specified location.
*/
p = [info objectForKey: @"Header"];
p = [p stringByDeletingLastPathComponent];
p = [p stringByAppendingPathComponent: line];
if ([mgr isReadableFileAtPath: p] == NO)
{
[self log: @"AutogsdocSource: %@ not "
@"found (tried %@ too)!",
line, p];
line = nil;
}
else
{
line = p;
}
}
}
if (line != nil)
{
[source addObject: line];
}
}
i = NSMaxRange(r);
r = NSMakeRange(i, commentLength - i);

View file

@ -58,7 +58,12 @@
making the assumption that each .h file processed uses a .m file
of the same name. You may supply multiple <code>AutogsdocSource</code>:
lines where a header file declares items which are defined in
multiple source files.
multiple source files.<br />
If a file name is absolute, it is used just as supplied.<br />
If on the other hand, it is a relative path, the software looks for
the source file first relative to the direcotory in which autogsdoc
is running and then, if not found there, relative to the directory
in which the header file is located.
</item>
<item><strong>&lt;abstract&gt;</strong>
An abstract of the content of the document ... placed in the head