comparison inst/ufl.m @ 223:8b159045242f

ufl errors out if filename exists when start command is issued
author Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
date Wed, 21 May 2014 18:16:05 +0200
parents 6671cb83a2dd
children a108a0bfe201
comparison
equal deleted inserted replaced
222:6671cb83a2dd 223:8b159045242f
44 filename = varargin{2}; 44 filename = varargin{2};
45 if (isempty (regexpi (filename, ".ufl$", "match"))) 45 if (isempty (regexpi (filename, ".ufl$", "match")))
46 filename = [filename, ".ufl"]; 46 filename = [filename, ".ufl"];
47 endif 47 endif
48 endif 48 endif
49 fid = fopen (filename, "w"); 49 [~, err, ~] = stat (filename);
50 if (err == 0)
51 error (["ufl: a file named ", filename, " already exists"]);
52 else
53 fid = fopen (filename, "w");
54 endif
50 endif 55 endif
51 if (! is_valid_file_id (fid)) 56 if (! is_valid_file_id (fid))
52 error (["ufl: could not open file ", filename]); 57 error (["ufl: could not open file ", filename]);
53 endif 58 endif
54 elseif (strcmpi (varargin{1}, "end")) 59 elseif (strcmpi (varargin{1}, "end"))