Skip to content

Commit 291c053

Browse files
authored
fixed #13921 - do not perform additional addon lookups with absolute path (danmar#7574)
1 parent 1015d71 commit 291c053

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/addoninfo.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ static std::string getFullPath(const std::string &fileName, const std::string &e
3434
if (Path::isFile(fileName))
3535
return fileName;
3636

37+
const bool is_abs_path = Path::isAbsolute(fileName);
38+
if (is_abs_path)
39+
return "";
40+
3741
const std::string exepath = Path::getPathFromFilename(exename);
3842
if (debug)
3943
std::cout << "looking for addon '" << (exepath + fileName) << "'" << std::endl;

test/cli/lookup_test.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -620,15 +620,11 @@ def test_addon_lookup_absolute_notfound(tmpdir):
620620

621621
addon_file = os.path.join(tmpdir, 'test.py')
622622

623-
exitcode, stdout, stderr, exe = cppcheck_ex(['--debug-lookup=addon', '--addon={}'.format(addon_file), test_file])
624-
exepath = os.path.dirname(exe)
625-
exepath_sep = exepath + os.path.sep
623+
exitcode, stdout, stderr = cppcheck(['--debug-lookup=addon', '--addon={}'.format(addon_file), test_file])
626624
assert exitcode == 1, stdout if stdout else stderr
627625
lines = stdout.splitlines()
628626
assert lines == [
629627
"looking for addon '{}'".format(addon_file),
630-
"looking for addon '{}{}'".format(exepath_sep, addon_file), # TODO: should not perform this lookup
631-
"looking for addon '{}addons/{}'".format(exepath_sep, addon_file), # TODO: should not perform this lookup
632628
'Did not find addon {}'.format(addon_file)
633629
]
634630

0 commit comments

Comments
 (0)