Skip to content

Conversation

@marcobarilari
Copy link
Collaborator

to check if this works on linux

fix #90

@marcobarilari marcobarilari added bug 🐛 Something isn't working priority 1 labels Oct 2, 2020
@marcobarilari marcobarilari linked an issue Oct 2, 2020 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Oct 2, 2020

Codecov Report

Merging #105 into dev will increase coverage by 1.95%.
The diff coverage is 60.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #105      +/-   ##
==========================================
+ Coverage   41.83%   43.78%   +1.95%     
==========================================
  Files          56       56              
  Lines        1310     1311       +1     
==========================================
+ Hits          548      574      +26     
+ Misses        762      737      -25     
Impacted Files Coverage Δ
src/spmBatching/bidsCopyRawFolder.m 62.50% <60.00%> (+62.50%) ⬆️
src/getData.m 100.00% <0.00%> (+2.56%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 30feb01...f4691cb. Read the comment docs.

@marcobarilari
Copy link
Collaborator Author

in case we want to track any errors from system we may want to use this (from help section in matlab)

returns status = 0 and, in result, a MATLAB character vector containing
    a list of files in the current directory (assuming your operating
    system knows about the "dir" or "ls" command). If "dir" or "ls" fails
    or does not exist on your system, system returns a nonzero value in
    status, and an explanatory message in result.

so it will be

try
    status =  system( ...
        sprintf('cp -R -L %s %s', ...
        fullfile(rawDir, subDir), ...
        fullfile(derivativesDir, subDir)));
    
    if status > 0
        error('...')
    end
    
catch
    message = [ ...
        'Copying data with system command failed: ' ...
        'are you running Windows?\n', ...
        'Will use matlab/octave copyfile command instead.\n', ...
        'Could be an issue if your data set contains symbolic links' ...
        '(e.g. if you use datalad or git-annex.'];
    warning(message);
    
    copyfile(fullfile(rawDir, subDir), ...
        fullfile(derivativesDir, subDir));
end

Copy link
Contributor

@Remi-Gau Remi-Gau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a VERY simple that relies on the fact that I download an SPM example BIDS dataset as part of the travis CI, so I can try this very test on it.

@CerenB have you confirmed that this fixed your problem #90 ?

@marcobarilari
Copy link
Collaborator Author

btw, let me know what you think about the 'error' thing, we can change it in the fly like

try
    status =  system( ...
        sprintf('cp -R -L %s %s', ...
        fullfile(rawDir, subDir), ...
        fullfile(derivativesDir, subDir)));
    
    if status > 0
        message = [ ...
             'Copying data with system command failed: ' ...
             'are you running Windows?\n', ...
             'Will use matlab/octave copyfile command instead.\n', ...
             'Could be an issue if your data set contains symbolic links' ...
              '(e.g. if you use datalad or git-annex.'];
        error(message)
    end
    
catch
    copyfile(fullfile(rawDir, subDir), ...
        fullfile(derivativesDir, subDir));
end

@CerenB
Copy link
Collaborator

CerenB commented Oct 5, 2020

yup looks good!

@Remi-Gau
Copy link
Contributor

Remi-Gau commented Oct 5, 2020

btw, let me know what you think about the 'error' thing, we can change it in the fly like

I am tired.

I thought we had added it: go ahead and add it. 🚀

@marcobarilari
Copy link
Collaborator Author

done

@Remi-Gau Remi-Gau merged commit f5bb3a0 into cpp-lln-lab:dev Oct 6, 2020
@marcobarilari marcobarilari deleted the marco_system-raw-copy-error branch October 6, 2020 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🐛 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bidsCopyRawFolder function

3 participants