19 lines (16 with data), 589 Bytes
dirlist = {"utl", "asm", "tst", "nls", "prs", "sbn"};
dirname = fileparts (canonicalize_file_name (mfilename ("fullpath")));
if (! exist (fullfile (dirname, "inst"), "dir"))
## Run this if the package is installed
for ii=1:length (dirlist)
addpath (fullfile (dirname, "..", dirlist{ii}), "-end")
endfor
else
## Run this if we are testing the package without installation
for ii=1:length(dirlist)
addpath (fullfile (dirname, "inst", dirlist{ii}))
addpath (fullfile (dirname, "src"))
endfor
endif
warning ("off", "Octave:fopen-file-in-path");
clear dirlist dirname