Open octomike opened 4 years ago
There is now a function spm_copy
that could be used in spm_BIDS_App.m
. The issue with symbolic links could then be dealt with there (spm_check_version
might come handy) or we could just switch to the MATLAB Runtime R2020a as you mention.
It seems safer to make hard copies as sources could be modified.
Okay, cool. So should I just revert the changes and change copyfile() to spm_copy() and leave this here until spm_copy is updated?
Yes, spm_copy
is just a wrapper around copyfile
but it will also uncompress and move sidecar .json
files as well. I will look building a new SPM12 standalone with R2020a that we could use here.
I tried running the SPM container on
ds000001
which I pulled with datalad. It turns out that datalad is using symbolic links for the images inanat/
andfunc/
etc pointing to a.git-annex
folder two levels above.Unfortunately,
copyfile()
on Linux with Matlab <= 2019b does not dereference the file and when SPM is copying a relative symlink to the tmp/output folder, the link breaks.This PR is checking if we are on Linux on Matlab < 2020a (with an ugly versioncmp hack) and uses
system('cp -rL...')
instead ofcopyfile()
.Also, as I mention in the comment, it would probably be much nicer to keep the symbolic links for all platforms, but I'm having a hard time coming up with a portable solution for that. And I'm also not entirely sure this is compatible with SPM's behavior (would it modify source files in that case?)