Add a New Comment (Rich Markup)
I also can't see much need for the "feature" of searching through the loadpath so I think it is okay to leave this as postponed. I made isdir.m a legacy function and updated Octave core to use isfolder instead. See https://hg.savannah.gnu.org/hgweb/octave/rev/e04c56bbbace.
I don't personally see a use case for 'exist' finding directories in the load path, so I don't feel strongly about it. But it is a compatibility issue. If you would rather keep 'isdir' as an alias for 'isfolder', we should do that and document that discrepancy, and the same with 'exist'. But I do want to make sure that we explicitly define 'isfolder' to be independent of 'exist', in case it does change in the future. And I do want to be sure that existing code is upgraded to use 'isfolder' wherever possible.
I was looking at the isfolder implementation as well, but I had a different idea. Since isdir() in Octave already behaves like isfolder() is supposed to, I thought we might change the documentation on isdir to reference dir_in_loadpath() if you want that sort of lookup. Otherwise, isdir and isfolder in Octave would be aliases for each other.
The Matlab function 'exist' looks for function files or mex files on the search path. If it is given an arbitrary file name, it also looks for that file on the search path. The same is true of directory names.
mkdir /tmp/mydir addpath /tmp exist ('mydir') ## this should return 7 exist ('mydir', 'dir') ## same
And the 'isdir' function follows the same logic, so it makes sense to be implemented using 'exist'. Fixing 'exist' will fix 'isdir', both should be documented as such. Since 'isdir' may find directories on the load path, the new function 'isfolder' (see bug #54456) should be preferred if the code expects to be dealing only with relative or absolute directory names. I beleve 'isfolder' should be added first, and existing code migrated to 'isfolder', before we change the underlying behavior of 'isdir'. We may also move 'isdir' to the scripts/legacy directory as part of this, since it is "not recommended" by Matlab.
(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)
Attach Files: Comment:
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Only project members can vote.
Please enter the title of George Orwell's famous dystopian book (it's a date):
Follow 2 latest changes.
Copyright © 2023 Free Software Foundation, Inc. Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. The Levitating, Meditating, Flute-playing Gnu logo is a GNU GPL'ed image provided by the Nevrax Design Team. Source Code
Powered by Savane 3.12