Skip to content
Snippets Groups Projects
Commit 5aec8a24 authored by Mark Winter's avatar Mark Winter
Browse files

Disable any user startup scripts before matlab compiler runs.

parent b39c8a5d
No related branches found
No related tags found
No related merge requests found
...@@ -91,10 +91,15 @@ function CompileLEVer() ...@@ -91,10 +91,15 @@ function CompileLEVer()
error('External dependencies cannot be packaged in a MATLAB executable'); error('External dependencies cannot be packaged in a MATLAB executable');
end end
% temporarily remove any startup scripts that would normally be run by matlabrc
enableStartupScripts(false);
compileMATLAB('LEVer', bindir, {}, toolboxStruct.deps); compileMATLAB('LEVer', bindir, {}, toolboxStruct.deps);
compileMATLAB('LEVER_SegAndTrackFolders', bindir, {}, toolboxStruct.deps); compileMATLAB('LEVER_SegAndTrackFolders', bindir, {}, toolboxStruct.deps);
compileMATLAB('Segmentor', bindir, {}, toolboxStruct.deps); compileMATLAB('Segmentor', bindir, {}, toolboxStruct.deps);
enableStartupScripts(true);
fprintf('\n'); fprintf('\n');
% mcrfile = mcrinstaller(); % mcrfile = mcrinstaller();
...@@ -198,3 +203,44 @@ function compileMATLAB(projectName, bindir, extrasList, toolboxList) ...@@ -198,3 +203,44 @@ function compileMATLAB(projectName, bindir, extrasList, toolboxList)
fprintf('Done (%f sec)\n', toc(compileTime)); fprintf('Done (%f sec)\n', toc(compileTime));
end end
function enableStartupScripts(bEnable)
searchPrefix = '';
renamePrefix = 'disabled_';
if ( bEnable )
searchPrefix = 'disabled_';
renamePrefix = '';
end
searchName = [searchPrefix 'startup.m'];
newName = [renamePrefix 'startup.m'];
startupScripts = findFilesInPath(searchName, userpath);
for i=1:length(startupScripts)
scriptPath = fileparts(startupScripts{i});
movefile(startupScripts{i}, fullfile(scriptPath,newName));
end
end
function fullNames = findFilesInPath(filename, searchPaths)
fullNames = {};
chkPaths = [];
while ( ~isempty(searchPaths) )
[newPath remainder] = strtok(searchPaths, pathsep);
if ( isempty(newPath) )
searchPaths = remainder;
continue;
end
chkPaths = [chkPaths; {newPath}];
searchPaths = remainder;
end
for i=1:length(chkPaths)
chkFullPath = fullfile(chkPaths{i}, filename);
if ( exist(chkFullPath, 'file') )
fullNames = [fullNames; {chkFullPath}];
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment