initWorkspaceSegmentation.m 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. function initWorkspaceSegmentation
  2. %% setup paths in use-specific manner
  3. if strcmp( getenv('USER'), 'freytag')
  4. % dependencies go here
  5. else
  6. fprintf('Unknown user %s and unknown default settings', getenv('USER') );
  7. end
  8. %% add paths
  9. % add main path
  10. b_recursive = false;
  11. b_overwrite = true;
  12. s_pathMain = fullfile(pwd);
  13. addPathSafely ( s_pathMain, b_recursive, b_overwrite )
  14. clear ( 's_pathMain' );
  15. %% clean up
  16. end
  17. function addPathSafely ( s_path, b_recursive, b_overwrite )
  18. if ( ~isempty(strfind(path, [s_path , pathsep])) )
  19. if ( b_overwrite )
  20. if ( b_recursive )
  21. rmpath( genpath( s_path ) );
  22. else
  23. rmpath( s_path );
  24. end
  25. else
  26. fprintf('InitPatchDiscovery - %s already in your path but overwriting de-activated.\n', s_path);
  27. return;
  28. end
  29. end
  30. if ( b_recursive )
  31. addpath( genpath( s_path ) );
  32. else
  33. addpath( s_path );
  34. end
  35. end