Bladeren bron

added init script for setting up workspace to allow for generic usage of library

Alexander Freytag 10 jaren geleden
bovenliggende
commit
48bb048fe4
1 gewijzigde bestanden met toevoegingen van 46 en 0 verwijderingen
  1. 46 0
      initWorkspaceSegmentation.m

+ 46 - 0
initWorkspaceSegmentation.m

@@ -0,0 +1,46 @@
+function initWorkspaceSegmentation
+
+    %% setup paths in use-specific manner
+    
+    if  strcmp( getenv('USER'), 'freytag')
+        % dependencies go here      
+    else
+        fprintf('Unknown user %s and unknown default settings', getenv('USER') ); 
+    end
+
+    %% add paths
+    
+    % add main path
+    b_recursive            = false; 
+    b_overwrite            = true;
+    s_pathMain             = fullfile(pwd);
+    addPathSafely ( s_pathMain, b_recursive, b_overwrite )
+    clear ( 's_pathMain' );      
+    
+    
+    
+    %% clean up
+        
+end
+
+
+function addPathSafely ( s_path, b_recursive, b_overwrite )
+    if ( ~isempty(strfind(path, [s_path , pathsep])) )
+        if ( b_overwrite )
+            if ( b_recursive )
+                rmpath( genpath( s_path ) );
+            else
+                rmpath( s_path );
+            end
+        else
+            fprintf('InitPatchDiscovery - %s already in your path but overwriting de-activated.\n', s_path);
+            return;
+        end
+    end
+    
+    if ( b_recursive )
+        addpath( genpath( s_path ) );
+    else
+        addpath( s_path );
+    end
+end