Skip to content

Commit

Permalink
simplification of update mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
tholden committed Jul 9, 2016
1 parent 41f6877 commit 8a6fc58
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions dynareOBC.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ function dynareOBC( InputFileName, varargin )
else
CurrentVersionURL = '';
end
NewCurrentVersionURL = CurrentVersionURL;

DownloadURL = regexp( urlread( 'https://api.github.com/repos/tholden/dynareOBC/releases/latest' ), 'https://github.com/tholden/dynareOBC/releases/download/[^\"]+\.zip', 'once', 'ignorecase', 'match' );
if strcmp( DownloadURL, CurrentVersionURL )
Expand All @@ -89,7 +88,7 @@ function dynareOBC( InputFileName, varargin )
fprintf( '\n' );
aria_urlwrite( dynareOBCPath, DownloadURL, [ dynareOBCPath '/CurrentRelease.zip' ] )
fprintf( '\n' );
NewCurrentVersionURL = '';
CurrentVersionURL = '';
disp( 'Deleting old DynareOBC files.' );
fprintf( '\n' );
WarningState = warning( 'off', 'all' );
Expand Down Expand Up @@ -125,7 +124,7 @@ function dynareOBC( InputFileName, varargin )
unzip( [ dynareOBCPath '/CurrentRelease.zip' ], dynareOBCPath );
addpath( [ dynareOBCPath '/Core/setup/' ] );
rehash;
NewCurrentVersionURL = DownloadURL;
CurrentVersionURL = DownloadURL;
end

end
Expand All @@ -137,7 +136,7 @@ function dynareOBC( InputFileName, varargin )
end

fprintf( '\n' );
if ~isempty( NewCurrentVersionURL )
if ~isempty( CurrentVersionURL )
dynareOBCSetup( OriginalPath, CurrentFolder, dynareOBCPath, InputFileName, varargin{:} );
else
disp( 'Since it does not appear that a valid DynareOBC version is installed, DynareOBC will not proceed.' );
Expand Down

0 comments on commit 8a6fc58

Please sign in to comment.