1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-11 20:29:36 +00:00

Merge pull request #1755 from rofl0r/fix_target_path

cl65: fix regression in --print-target-path
This commit is contained in:
Bob Andrews 2022-06-04 16:33:46 +02:00 committed by GitHub
commit 30dc9b8d1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 */