mirror of
https://github.com/cc65/cc65.git
synced 2025-02-01 09:30:10 +00:00
cl65: fix regression in --print-target-path
since the "empty prefix means run from current dir" hack was removed, cl65 --print-target-path no longer prints the path relative to the binary, but the hardcoded library path which points to prefix, because the code adds the hardcoded path first to the pathsearch, but then actually only returns the first entry rather than looking whether the path exists. closes #1754
This commit is contained in:
parent
dcdf7ade08
commit
94e7b11870
@ -1212,6 +1212,7 @@ static void OptPrintTargetPath (const char* Opt attribute ((unused)),
|
||||
/* Print the target file path */
|
||||
{
|
||||
char* TargetPath;
|
||||
char* tmp;
|
||||
|
||||
SearchPaths* TargetPaths = NewSearchPath ();
|
||||
AddSubSearchPathFromEnv (TargetPaths, "CC65_HOME", "target");
|
||||
@ -1220,7 +1221,15 @@ static void OptPrintTargetPath (const char* Opt attribute ((unused)),
|
||||
#endif
|
||||
AddSubSearchPathFromBin (TargetPaths, "target");
|
||||
|
||||
TargetPath = GetSearchPath (TargetPaths, 0);
|
||||
TargetPath = SearchFile (TargetPaths, ".");
|
||||
if (!TargetPath) {
|
||||
fprintf (stderr, "%s: error - could not determine target path\n", ProgName);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
tmp = strrchr(TargetPath, '.');
|
||||
if (tmp) {
|
||||
*(--tmp) = 0;
|
||||
}
|
||||
while (*TargetPath) {
|
||||
if (*TargetPath == ' ') {
|
||||
/* Escape spaces */
|
||||
|
Loading…
x
Reference in New Issue
Block a user