Using modules from multiple directories

14 views
Skip to first unread message

Steve Cumming

unread,
Mar 24, 2016, 4:48:36 PM3/24/16
to SpaDES Users
Greetings:

I have taken to stratifying modules for my course labs in their own directories. But in some cases, I want to reuse modules without copying or moving them.

Is there a way to have modulePath search more than one place?

Steve

Eliot McIntire

unread,
Mar 24, 2016, 5:13:08 PM3/24/16
to SpaDES Users
Currently there is not a way to do this within SpaDES. The recommendation at this point is to create symlinks in your operating system. That way you have 1 copy of each, but they appear in different places, depending on usage. Because of the easy potential for spaghetti code (where each module is in a different folder), we felt that it was cleaner to not add this functionality. It could rapidly get ugly if there are 10 modules, all in different directories. It would be hard to share your model with people, for example.

Eliot McIntire

unread,
Mar 24, 2016, 6:29:49 PM3/24/16
to SpaDES Users
On windows: 
mklink /D c:\Path\To\New\Location\Directory c:\Path\To\Original\Directory
(Note the first argument must contain the name of the new directory, i.e., it doesn't exist yet, whereas the second argument must be a directory that exists)

It is the other way in *nix
On *nix:
ln -s /Path/To/Original/Location /Path/To/New/Location/
(Note , this is slightly different than windows, in the second argument, you can leave the trailing directory empty and the original directory name will be used)

Steve Cumming

unread,
Mar 24, 2016, 8:26:02 PM3/24/16
to SpaDES Users
That could work, symlinks, I mean. 

Does the parent relationship provide some degree of nestedness? If the "modules" path were searched recursively, for example?

sc

Eliot McIntire

unread,
Mar 24, 2016, 8:36:54 PM3/24/16
to SpaDES Users
Parent and child does not imply any nestedness from a folder perspective. They should all be at the same level in the folder hierarchy.

This can certainly be relaxed in the future, if needed, but for now, it will keep models clean.

Steve Cumming

unread,
Mar 24, 2016, 8:40:05 PM3/24/16
to SpaDES Users
Thank you for explaining.

I think there should be file-structure related way of grouping related
modules, and even allowing names to be same between groups.....but this can
be considered carefully at some more convenient time.
Reply all
Reply to author
Forward
0 new messages