% Leave project in current folder
function leave(d)
    if ~exist('d', 'var') || isempty(d)
        d = pwd;
    end

    state = mpm.load_state();

    sp = mpm.subpaths(d);
    for i = 1:length(sp)
        subpath = fullfile(pwd, sp{i});
        rmpath(subpath);
        state.added_paths.remove(subpath);
    end

    mpm.save_state(state)
end
