mirror of
https://github.com/cc65/cc65.git
synced 2025-01-28 00:30:12 +00:00
Don't ignore empty paths when adding the path of a file to the search path
list. git-svn-id: svn://svn.cc65.org/cc65/trunk@4674 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
02f5b5499e
commit
314893619a
@ -148,7 +148,7 @@ static AFile* NewAFile (IFile* IF, FILE* F)
|
|||||||
* the path search list, and finally return a pointer to the new AFile struct.
|
* the path search list, and finally return a pointer to the new AFile struct.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
const char* Filename;
|
StrBuf Path = AUTO_STRBUF_INITIALIZER;
|
||||||
|
|
||||||
/* Allocate a AFile structure */
|
/* Allocate a AFile structure */
|
||||||
AFile* AF = (AFile*) xmalloc (sizeof (AFile));
|
AFile* AF = (AFile*) xmalloc (sizeof (AFile));
|
||||||
@ -187,24 +187,14 @@ static AFile* NewAFile (IFile* IF, FILE* F)
|
|||||||
/* Insert the new structure into the AFile collection */
|
/* Insert the new structure into the AFile collection */
|
||||||
CollAppend (&AFiles, AF);
|
CollAppend (&AFiles, AF);
|
||||||
|
|
||||||
/* Get the path of this file. If it is not empty, add it as an extra
|
/* Get the path of this file and add it as an extra search path.
|
||||||
* search path. To avoid file search overhead, we will not add empty
|
* To avoid file search overhead, we will add one path only once.
|
||||||
* paths, since the search path list is initialized with an empty
|
* This is checked by the PushSearchPath function.
|
||||||
* path, so files in the current directory are always found first.
|
|
||||||
*/
|
*/
|
||||||
Filename = FindName (IF->Name);
|
SB_CopyBuf (&Path, IF->Name, FindName (IF->Name) - IF->Name);
|
||||||
AF->SearchPath = (Filename - IF->Name); /* Actually the length */
|
|
||||||
if (AF->SearchPath) {
|
|
||||||
/* We have a path, extract and push it to the search path list */
|
|
||||||
StrBuf Path = AUTO_STRBUF_INITIALIZER;
|
|
||||||
SB_CopyBuf (&Path, IF->Name, AF->SearchPath);
|
|
||||||
SB_Terminate (&Path);
|
SB_Terminate (&Path);
|
||||||
if (PushSearchPath (UsrIncSearchPath, SB_GetConstBuf (&Path)) == 0) {
|
AF->SearchPath = PushSearchPath (UsrIncSearchPath, SB_GetConstBuf (&Path));
|
||||||
/* The path is already there ... */
|
|
||||||
AF->SearchPath = 0;
|
|
||||||
}
|
|
||||||
SB_Done (&Path);
|
SB_Done (&Path);
|
||||||
}
|
|
||||||
|
|
||||||
/* Return the new struct */
|
/* Return the new struct */
|
||||||
return AF;
|
return AF;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user