octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #63753] wrong function called after changing d


From: anonymous
Subject: [Octave-bug-tracker] [bug #63753] wrong function called after changing directory
Date: Tue, 7 Feb 2023 08:05:50 -0500 (EST)

Follow-up Comment #2, bug #63753 (project octave):

In case it wasn't clear, this was meant to be a minimal demonstration of a
problem with locating/calling functions after a "change directory", not a
specific use case. The behavior is the same if you change the names to
"myfcn".

And thank you, your "other coding strategy" comment helped me think of a
workaround: prepending the path with '.' (even though the path should always
begin with '.') produces the desired behavior (hopefully that's helpful to
anyone else with this issue).


a/myfcn.m:
function test()
  printf('correct version\n');
end

b/myfcn.m:
function myfcn()
  printf('incorrect version, changing directory\n');
  cd('../a');
  addpath ('.', 0);
  myfcn();
  cd('../b');
end




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63753>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]