Mercurial > fem-fenics-eugenio
changeset 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 |
files | inst/ufl.m |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/inst/ufl.m Wed May 21 17:56:22 2014 +0200 +++ b/inst/ufl.m Wed May 21 18:16:05 2014 +0200 @@ -46,7 +46,12 @@ filename = [filename, ".ufl"]; endif endif - fid = fopen (filename, "w"); + [~, err, ~] = stat (filename); + if (err == 0) + error (["ufl: a file named ", filename, " already exists"]); + else + fid = fopen (filename, "w"); + endif endif if (! is_valid_file_id (fid)) error (["ufl: could not open file ", filename]);