diff --git a/+ws/WavesurferModel.m b/+ws/WavesurferModel.m index 1180f3af..b9e98346 100644 --- a/+ws/WavesurferModel.m +++ b/+ws/WavesurferModel.m @@ -166,9 +166,20 @@ self.RefillerIPCSubscriber_.setDelegate(self) ; self.RefillerIPCSubscriber_.connect(ws.WavesurferModel.RefillerIPCPublisherPortNumber) ; - % Start the other Matlab processes - system('start matlab -nojvm -minimize -r "looper=ws.Looper(); looper.runMainLoop(); clear; quit()"'); - system('start matlab -nojvm -minimize -r "refiller=ws.Refiller(); refiller.runMainLoop(); clear; quit()"'); + % Start the other Matlab processes, passing the relevant + % path information to make sure they can find all the .m + % files they need. + [pathToRepoRoot,pathToMatlabZmqLib] = ws.WavesurferModel.pathNamesThatNeedToBeOnSearchPath() ; + looperLaunchString = ... + sprintf('start matlab -nojvm -minimize -r "addpath(''%s''); addpath(''%s''); looper=ws.Looper(); looper.runMainLoop(); clear; quit()"' , ... + pathToRepoRoot , ... + pathToMatlabZmqLib ) ; + system(looperLaunchString) ; + refillerLaunchString = ... + sprintf('start matlab -nojvm -minimize -r "addpath(''%s''); addpath(''%s''); refiller=ws.Refiller(); refiller.runMainLoop(); clear; quit()"' , ... + pathToRepoRoot , ... + pathToMatlabZmqLib ) ; + system(refillerLaunchString) ; %system('start matlab -nojvm -minimize -r "looper=ws.Looper(); looper.runMainLoop(); quit()"'); %system('start matlab -r "dbstop if error; looper=ws.Looper(); looper.runMainLoop(); quit()"'); @@ -176,7 +187,7 @@ % Start broadcasting pings until the satellite processes % respond - nPingsMax=60 ; + nPingsMax=20 ; isLooperAlive=false; isRefillerAlive=false; for iPing = 1:nPingsMax , @@ -2129,6 +2140,21 @@ function mimicUserSettings_(self, other) end % function end % public methods block + methods (Static) + function [pathToRepoRoot,pathToMatlabZmqLib] = pathNamesThatNeedToBeOnSearchPath() + % Allow user to invoke Wavesurfer from the Matlab command line, for + % this Matlab session only. Modifies the user's Matlab path, but does + % not safe the modified path. + + pathToWavesurferModel = mfilename('fullpath') ; + pathToWsModulerFolder = fileparts(pathToWavesurferModel) ; % should be +ws folder + pathToRepoRoot = fileparts(pathToWsModulerFolder) ; % should be repo root + pathToMatlabZmqLib = fullfile(pathToRepoRoot,'matlab-zmq','lib') ; + + %result = { pathToRepoRoot , pathToMatlabZmqLib } ; + end + end % static methods block + end % classdef diff --git a/installWavesurferForNow.m b/installWavesurferForNow.m index 27075732..b20a5466 100644 --- a/installWavesurferForNow.m +++ b/installWavesurferForNow.m @@ -3,16 +3,16 @@ function installWavesurferForNow() % this Matlab session only. Modifies the user's Matlab path, but does % not safe the modified path. - wavesurferPath = which('wavesurfer'); + %wavesurferPath = which('wavesurfer'); + pathToInstallWavesurferForNow = mfilename('fullpath'); + +% % This really shouldn't happen given that this function is distributed in the +% % same directory as wavesurfer.m. +% if isempty(pathToInstallWavesurferForNow) , +% error('wavesurfer:configureFailure', 'Wavesurfer does not appear to be installed correctly. wavesurfer.m is missing.\n'); +% end - % This really shouldn't happen given that this function is distributed in the - % same directory as wavesurfer.m. - if isempty(wavesurferPath) , - error('wavesurfer:configureFailure', 'Wavesurfer does not appear to be installed correctly. wavesurfer.m is missing.\n'); - end - - wavesurferParentFolder=fileparts(wavesurferPath); - addpath(wavesurferParentFolder); - %addpath(fullfile(wavesurferParentFolder,'wavesurfer_guis')); - addpath(fullfile(wavesurferParentFolder,'matlab-zmq','lib')); + repoRootFolderName=fileparts(pathToInstallWavesurferForNow); + addpath(repoRootFolderName); + addpath(fullfile(repoRootFolderName,'matlab-zmq','lib')); end