Back to the main page.

Bug 1032 - make the check on the existence of the file in ft_read_xxx consistent

Status CLOSED WONTFIX
Reported 2011-10-12 11:36:00 +0200
Modified 2019-08-10 12:28:46 +0200
Product: FieldTrip
Component: fileio
Version: unspecified
Hardware: All
Operating System: All
Importance: P4 enhancement
Assigned to: Eelke Spaak
URL:
Tags:
Depends on:
Blocks:
See also:

Robert Oostenveld - 2011-10-12 11:36:37 +0200

not all functions check for the file, and the place where the check is done is not consistent % test whether the file exists if ~exist(filename) error(sprintf('file ''%s'' does not exist', filename)); end


Robert Oostenveld - 2011-10-12 11:44:38 +0200

please note that ft_read_header does the following % test whether the file or directory exists if ~exist(filename, 'file') && ~strcmp(ft_filetype(filename), 'ctf_shm') && ~strcmp(ft_filetype(filename), 'fcdc_mysql') && ~strcmp(ft_filetype(filename), 'fcdc_buffer') error('FILEIO:InvalidFileName', 'file or directory ''%s'' does not exist', filename); end


Boris Reuderink - 2011-11-17 10:46:48 +0100

Changed the status of bugs without a specific owner to UNCONFIRMED. I'll try to replicate these bugs (potentially involving the submitter), and change confirmed bugs to NEW. Boris


Boris Reuderink - 2012-01-03 15:17:05 +0100

What would you suggest? Could we add a replacement for fopen that prints user-friendly warnings? Maybe this can be combined with the reading of .zip or .gz files?


Jan-Mathijs Schoffelen - 2012-01-27 08:45:25 +0100

assigned bug to get all bugs lined up before the grand bug binge


Boris Reuderink - 2012-03-26 13:38:31 +0200

Undoing JM bug-lineup for past bug-binge.


Jan-Mathijs Schoffelen - 2012-09-19 14:31:35 +0200

this goes for all ft_read_xxx functions. the check should also deal with resource identifiers


Jan-Mathijs Schoffelen - 2012-09-19 14:33:18 +0200

the above comment has been discussed in FT-meeting 19-09-2012


Robert Oostenveld - 2012-09-19 17:14:36 +0200

(In reply to comment #6) I just had a look in /Volumes/Data/roboos/matlab/fieldtrip/fileio manzana> grep error.*exi *.m ft_read_data.m: error('FILEIO:InvalidFileName', 'file or directory ''%s'' does not exist', filename); ft_read_header.m: error('FILEIO:InvalidFileName', 'file or directory ''%s'' does not exist', filename); ft_read_headshape.m: error('file ''%s'' does not exist', filename); ft_read_mri.m: error(sprintf('file ''%s'' does not exist', filename)); ft_read_sens.m: error('file ''%s'' does not exist', filename); ft_read_vol.m: error(sprintf('file ''%s'' does not exist', filename)); Regarding ft_read_xxx, the ft_read_event and ft_read_spike are missing here. Regarding the URI handling, these are the ones I know of manzana> grep uri ft_filetype.m elseif filetype_check_uri(filename, 'fifo') elseif filetype_check_uri(filename, 'buffer') elseif filetype_check_uri(filename, 'mysql') elseif filetype_check_uri(filename, 'tcp') elseif filetype_check_uri(filename, 'udp') elseif filetype_check_uri(filename, 'rfb') elseif filetype_check_uri(filename, 'serial') elseif filetype_check_uri(filename, 'global') elseif filetype_check_uri(filename, 'shm') elseif filetype_check_uri(filename, 'empty') Also if you do manzana> grep filetype_check_uri *.m you will see that the filetype_check_uri helper function is used elsewhere to parse the URI string. I don't know how that will help you, but I just thought I'd mention it ;-)


Eelke Spaak - 2014-01-29 15:05:52 +0100

this problem does not seem important anymore


Robert Oostenveld - 2019-08-10 12:28:46 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue describing the issue on https://github.com/fieldtrip/fieldtrip/issues.