Commit ed93e886 authored by jayd1860's avatar jayd1860
Browse files

-- Fix issue with setpaths submodules when there's a partial submodules...

-- Fix issue with setpaths submodules when there's a partial submodules download because of a previous error then need to clean uo submodule folders so there's no garbage in there then retry downloading.
parent 9bac7d6a
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
function cleanupSharedLibs()
submodules = parseGitSubmodulesFile();
for ii = 1:size(submodules,1)
    submodulepath   = submodules{ii,3};
    if ispathvalid_startup(submodulepath)
        if ispathvalid_startup([submodulepath, '.old/'])
            fprintf('Deleteing folder %s\n', [submodulepath, '.old/']);
            rmdir([submodulepath, '.old/'],'s')
        end
        fprintf('Moving %s  to  %s\n', submodulepath, [submodulepath, '.old']);
        copyfile([submodulepath, '/*'], [submodulepath, '.old/']);
        fprintf('Removing contents of %s\n', submodulepath);
        removeFolderContents(submodulepath);
    end    
    fprintf('\n');
end
 No newline at end of file
+21 −11
Original line number Diff line number Diff line
@@ -71,8 +71,6 @@ if isempty(paths0)
    return
end

setNamespace('Homer3');

options = parseOptions(options_str);
if ~options.add
    options.conflcheck = false;
@@ -241,6 +239,9 @@ end

% ----------------------------------------------------
function paths = startupPaths(options_str)
nTries = 2;
h = waitbar(0,'Please wait...downloading shared libraries.');
for iTry = 1:nTries    
    paths = getpathsStartup();
    for ii = 1:length(paths)
        % fprintf('Adding startup path %s\n', paths{ii});
@@ -252,11 +253,20 @@ for ii = 1:length(paths)
            [cmds, errs, msgs] = downloadSharedLibs(options_str); %#ok<ASGLU>
        end
    end
    try
        setNamespace('Homer3');
        break;
    catch
        cleanupSharedLibs();
    end   
end
close(h)
if ~all(errs==0)
    paths = [];
end



% ----------------------------------------------------
function paths = getpathsStartup()
global startup