From d1483fcafb9c5898fcb9b3cbd9120568eb617cab Mon Sep 17 00:00:00 2001 From: Rahul Arora Date: Fri, 17 Jan 2020 16:29:09 -0500 Subject: [PATCH] Update md5 code in cdt.m to work on linux/windows The system() call to generate MD5 hash was Mac-specific. Updated to include Linux and windows calls --- mesh/cdt.m | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mesh/cdt.m b/mesh/cdt.m index cbab6351..1e10a9b4 100644 --- a/mesh/cdt.m +++ b/mesh/cdt.m @@ -99,7 +99,15 @@ save(tmpf,'-regexp',sprintf('^%s$|',variables{:}),'-ascii'); % get md5 checksum on input "state", we append .cache.mat to the check sum % because we'll use the checksum as the cache file name - [s,cache_name] = system(['/sbin/md5 -r ' tmpf ' | awk ''{printf "."$1".cache.mat"}''']); + if ismac + [~,cache_name] = system(['/sbin/md5 -r ' tmpf ' | awk ''{printf "."$1".cache.mat"}''']); + elseif isunix + [~,cache_name] = system(['md5sum ' tmpf ' | awk ''{printf "."$1".cache.mat"}''']); + else + [~,cache_name] = system(['CertUtil -hashfile ' tmpf ' MD5']); + cache_name = feval(@(x) ['.' x{2} '.cache.mat'], ... + strsplit(cache_name, '\n')); + end % clean up delete(tmpf); clear s tmpf variables;