changeset 0:a549d0cd3775

Initial commit
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 10 Sep 2018 14:17:52 +0200
parents
children 2007c2cd566a
files +mpm/leave.m +mpm/set.m +mpm/subpackages.m
diffstat 3 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/+mpm/leave.m	Mon Sep 10 14:17:52 2018 +0200
@@ -0,0 +1,11 @@
+% Leave project in current folder
+function leave(d)
+    if ~exist('d', 'var') || isempty(d)
+        d = pwd;
+    end
+
+    sp = project.subpackages(d);
+    for i = 1:length(sp)
+        rmpath(fullfile(pwd, sp{i}));
+    end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/+mpm/set.m	Mon Sep 10 14:17:52 2018 +0200
@@ -0,0 +1,11 @@
+% Set project to current folder
+function set(d)
+    if ~exist('d', 'var') || isempty(d)
+        d = pwd;
+    end
+
+    sp = project.subpackages(d);
+    for i = 1:length(sp)
+        addpath(fullfile(pwd, sp{i}));
+    end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/+mpm/subpackages.m	Mon Sep 10 14:17:52 2018 +0200
@@ -0,0 +1,9 @@
+function sp = subpackages(d)
+    if ~exist('d', 'var') || isempty(d)
+        d = pwd;
+    end
+
+    % TODO: Nice error message if file doesn't exist
+    fstr = fileread('.subpaths');
+    sp = splitlines(strtrim(fstr));
+end