Open michael-pont opened 4 years ago
Yes, the automatic addition of a single package's paths via the startup.m mechanism is what I would expect. I assume what you're seeing is that you exit MATLAB from one of the Software/MATLAB directories (S3 or SQS) and then when you restart it returns to that directory and runs the included startup.m. So it will pick up one but not both. This is deliberate for now as we don't know which subset of AWS packages a customer may wish to use, but I note that it is a complication for you and will look at a higher-level startup process.
I think you have the following options for now:
Your existing work-around, or similar, whereby if you start from SQS you check for and add S3 or vice versa.
Use your 'top-level' startup.m to launch both package specific startup.m files. You can have a user defined startup.m that runs at startup regardless of the launch directory and in that you could call both package's startups, see: https://uk.mathworks.com/help/matlab/ref/startup.html
Build a list of custom paths and add them without using the startup.m files. Particularly as work moves out of development and into production you may opt to more permanently add the paths and not use the startup scripts. Stepping through the scripts or diffing the before and after paths will give you the values for your system. Then they can be added using addpath: [https://uk.mathworks.com/help/matlab/ref/addpath.html(https://uk.mathworks.com/help/matlab/ref/addpath.html) If you configure them with the scripts as you do now, you can use savepath to capture that state. Note the jar files would have to be added to the Java class path as described here: https://uk.mathworks.com/help/matlab/ref/javaaddpath.html
Currently I do a combination of 1 and 2. I tried doing number 3 (adding the paths permanently for all matlab instances after observing the paths added by the startup functions), however, I think the addition of the Jar files was what I was missing when sometimes a particular package wouldn't work. I will try doing that then. Thank you :)
For use of multiple clients at the same time, e.g., s3 and sqs, the adding of the folder with startup function to matlab path sometimes does not run when Matlab is opened. Sometimes only sqs is added with aws common, other time it is only s3. I made a hotfix by adding my own startup function in my project that finds the respective aws startup functions (for me s3, sqs, and common) to run (changes directory there and runs it). Just wondering if you can reproduce this behavior since it requires a weird fix on my end.