Added --print-target-path option.

If cc65 is installed and used as designed there's no need whatsoever for CC65_HOME (both on *IX and Windows) from the perspective of the cc65 binaries. If the user however has to access files from the 'target' directory thenhe ends up with some assumption on the cc65 installation path nevertheless :-(

In order to avoid this I added the --print-target-path option. It "exports" the logic used by the cc65 binaries to locate their files to the user thus allowing him to leverage the same logic to locate the target files in his build scripts / Makefiles.
This commit is contained in:
Oliver Schmidt
2016-06-03 11:08:53 +02:00
parent 9f01392922
commit 8dd003d2b3
5 changed files with 103 additions and 53 deletions

View File

@@ -238,6 +238,18 @@ void PopSearchPath (SearchPaths* P)
char* GetSearchPath (SearchPaths* P, unsigned Index)
/* Return the search path at the given index, if the index is valid, return an
** empty string otherwise.
*/
{
if (Index < CollCount (P))
return CollAtUnchecked (P, Index);
return "";
}
char* SearchFile (const SearchPaths* P, const char* File)
/* Search for a file in a list of directories. Return a pointer to a malloced
** area that contains the complete path, if found, return 0 otherwise.

View File

@@ -94,6 +94,11 @@ int PushSearchPath (SearchPaths* P, const char* NewPath);
void PopSearchPath (SearchPaths* P);
/* Remove a search path from the head of an existing search path list */
char* GetSearchPath (SearchPaths* P, unsigned Index);
/* Return the search path at the given index, if the index is valid, return an
** empty string otherwise.
*/
char* SearchFile (const SearchPaths* P, const char* File);
/* Search for a file in a list of directories. Return a pointer to a malloced
** area that contains the complete path, if found, return 0 otherwise.