From d48b0715e26339b44cf20dbc1038170a2fd7e658 Mon Sep 17 00:00:00 2001 From: Luis Mendo Date: Mon, 25 Jan 2016 02:21:43 +0100 Subject: [PATCH] Compiled file is now deleted initially only if it existed --- matl_compile.m | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/matl_compile.m b/matl_compile.m index f4bb4d5..5979b30 100644 --- a/matl_compile.m +++ b/matl_compile.m @@ -278,12 +278,14 @@ % Write to file: -delete(cOutFile) % even though `fwrite` discards the file's previous contents, and there's a `clear` -% later, I delete the file initially here. I do it just in case: at some point I've -% seen Octave run an old version of the compiled file after changing the source code (which produces -% a new compiled file). I think this must a a file cache thing. (Even accidentally deleting a file -% before attemtping to run it sometimes resulted in a successful run!) I'm not sure how helpful -% deleting the file will be, though. +if exist(cOutFile,'file') + delete(cOutFile) % even though `fwrite` discards the file's previous contents, and there's a `clear` + % later, I delete the file initially here. I do it just in case: at some point I've + % seen Octave run an old version of the compiled file after changing the source code (which produces + % a new compiled file). I think this must a a file cache thing. (Even accidentally deleting a file + % before attemtping to run it sometimes resulted in a successful run!) I'm not sure how helpful + % deleting the file will be, though. +end fid = fopen(cOutFile,'w'); for n = 1:numel(C) if ispc % Windows