NeurodataWithoutBorders / matnwb

A Matlab interface for reading and writing NWB files
BSD 2-Clause "Simplified" License
49 stars 32 forks source link

working dir dependency #69

Closed bendichter closed 6 years ago

bendichter commented 6 years ago

Some matnwb functions require that the working directory is matnwb, and this can be cumbersome when using other tools (especially if those other tools also have a requirement of a different working directory). Would it be possible to alter functions like generateExtension so that they work no matter where you run them? Could we use environmental variables for this?

lawrence-mbf commented 6 years ago

I know that generateCore works outside the matnwb directory if you add matnwb to the matlab path. What functions are you using?

bendichter commented 6 years ago

I've been having issues with generateExtension creating a namespaces dir in random directories.

lawrence-mbf commented 6 years ago

generateExtension will always create a namespaces directory in the current directory where you called it. Would it make more sense for it to be stored in the matnwb directory itself?

bendichter commented 6 years ago

I took the fact that namespaces is plural to imply that it holds multiple namespaces, which means extensions in addition to core. I also think that's more convenient that way. Maybe we could offer an override, but I think it makes sense to write extensions to matnwb/namespaces by default.

Also, when I try to run generateExtension in a random directory, I get the following error:

Error using load
'./namespaces/core.mat' is not found in the
current folder or on the MATLAB path, but exists
in:
    /Users/bendichter/dev/matnwb

Change the MATLAB current folder or add its
folder to the MATLAB path.

Error in schemes.loadNamespace (line 8)
namespace = load(schemaPath);

Error in schemes.loadNamespace (line 24)
        extNamespaces = [extNamespaces;
        schemes.loadNamespace(depname,
        extNamespaces)];

Error in generateExtension (line 38)
extmap = schemes.loadNamespace(extSchema.name);
lawrence-mbf commented 6 years ago

Would it be preferable for the generate... functions to write everything into the matnwb directory and not to the local directory?

bendichter commented 6 years ago

I think so

lawrence-mbf commented 6 years ago

be7be5e5b36aab738b53fa61a0c50d5e12a40114 This is fixed for namespaces but the classes are still generated in the working directory as it breaks tests in a strange way.

bendichter commented 6 years ago

ok