Skip to content

Commit

Permalink
Mac update function
Browse files Browse the repository at this point in the history
  • Loading branch information
magnusmanske committed Sep 9, 2005
1 parent 6bd8f7a commit 22e7dd7
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 66 deletions.
29 changes: 13 additions & 16 deletions GENtle.xcodeproj/magnusmanske.mode1
Expand Up @@ -218,8 +218,6 @@
<key>Layout</key>
<array>
<dict>
<key>BecomeActive</key>
<true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXBottomSmartGroupGIDs</key>
Expand Down Expand Up @@ -366,9 +364,9 @@
</array>
<key>TableOfContents</key>
<array>
<string>91D4058B08D06C95009FDB0E</string>
<string>91F7D97608D16B770043ED53</string>
<string>1CE0B1FE06471DED0097A5F4</string>
<string>91D4058C08D06C95009FDB0E</string>
<string>91F7D97708D16B770043ED53</string>
<string>1CE0B20306471E060097A5F4</string>
<string>1CE0B20506471E060097A5F4</string>
</array>
Expand Down Expand Up @@ -502,9 +500,10 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
<string>1C530D57069F1CE1000CFCEE</string>
<string>9180A7220866FE4F000C7D5E</string>
<string>/Users/magnusmanske/GENtle/GENtle.xcodeproj</string>
<string>1C0AD2B3069F1EA900FABCE6</string>
<string>/Users/magnusmanske/GENtle/GENtle.xcodeproj</string>
</array>
<key>WindowString</key>
<string>207 340 690 397 0 0 1024 746 </string>
Expand All @@ -523,14 +522,12 @@
<key>Dock</key>
<array>
<dict>
<key>BecomeActive</key>
<true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXProjectModuleGUID</key>
<string>1CD0528F0623707200166675</string>
<key>PBXProjectModuleLabel</key>
<string>window.h</string>
<string>&lt;No Editor&gt;</string>
<key>StatusBarVisibility</key>
<true/>
</dict>
Expand Down Expand Up @@ -586,7 +583,7 @@
<key>TableOfContents</key>
<array>
<string>9180A7220866FE4F000C7D5E</string>
<string>91D4058608D06C8F009FDB0E</string>
<string>91F7D98708D176930043ED53</string>
<string>1CD0528F0623707200166675</string>
<string>XCMainBuildResultsModuleGUID</string>
</array>
Expand Down Expand Up @@ -717,12 +714,14 @@
<key>Dock</key>
<array>
<dict>
<key>BecomeActive</key>
<true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXProjectModuleGUID</key>
<string>1CDD528C0622207200134675</string>
<key>PBXProjectModuleLabel</key>
<string>ExternalNCBI.cpp</string>
<string>SendHTTP.cpp</string>
<key>StatusBarVisibility</key>
<true/>
</dict>
Expand All @@ -743,8 +742,6 @@
<string>212pt</string>
</dict>
<dict>
<key>BecomeActive</key>
<true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXProjectModuleGUID</key>
Expand Down Expand Up @@ -780,8 +777,8 @@
<key>TableOfContents</key>
<array>
<string>1C530D57069F1CE1000CFCEE</string>
<string>91410F7908D0493500776D65</string>
<string>91410F7A08D0493500776D65</string>
<string>91F7D98F08D17DAF0043ED53</string>
<string>91F7D99008D17DAF0043ED53</string>
<string>1CDD528C0622207200134675</string>
<string>1CD0528E0623707200166675</string>
</array>
Expand Down Expand Up @@ -933,9 +930,9 @@
<key>TableOfContents</key>
<array>
<string>1C0AD2B3069F1EA900FABCE6</string>
<string>91D4058708D06C8F009FDB0E</string>
<string>91F7D97808D16B780043ED53</string>
<string>1CD0528B0623707200166675</string>
<string>91D4058808D06C8F009FDB0E</string>
<string>91F7D97908D16B780043ED53</string>
</array>
<key>ToolbarConfiguration</key>
<string>xcode.toolbar.config.run</string>
Expand Down
16 changes: 8 additions & 8 deletions GENtle.xcodeproj/magnusmanske.pbxuser
Expand Up @@ -83,8 +83,8 @@
PBXFileDataSource_SCM_ColumnID,
);
};
PBXPerProjectTemplateStateSaveDate = 147874413;
PBXWorkspaceStateSaveDate = 147874413;
PBXPerProjectTemplateStateSaveDate = 147942249;
PBXWorkspaceStateSaveDate = 147942249;
};
sourceControlManager = 9180A64F0866FCF9000C7D5E /* Source Control */;
userBuildSettings = {
Expand Down Expand Up @@ -335,9 +335,9 @@
};
9180A67C0866FD46000C7D5E /* MyFrame.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1616, 30730}}";
sepNavSelRange = "{34456, 23}";
sepNavVisRect = "{{0, 14268}, {925, 543}}";
sepNavIntBoundsRect = "{{0, 0}, {1616, 31150}}";
sepNavSelRange = "{58450, 0}";
sepNavVisRect = "{{0, 24667}, {925, 543}}";
sepNavWindowFrame = "{{38, 48}, {964, 672}}";
};
};
Expand Down Expand Up @@ -419,9 +419,9 @@
};
9180A68A0866FD46000C7D5E /* SendHTTP.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1034, 10080}}";
sepNavSelRange = "{10514, 12}";
sepNavVisRect = "{{0, 6694}, {925, 543}}";
sepNavIntBoundsRect = "{{0, 0}, {740, 1414}}";
sepNavSelRange = "{2202, 0}";
sepNavVisRect = "{{0, 1234}, {740, 180}}";
sepNavWindowFrame = "{{38, 48}, {964, 672}}";
};
};
Expand Down
89 changes: 48 additions & 41 deletions MyFrame.cpp
Expand Up @@ -195,11 +195,14 @@ void MyFrame::initme ()

#ifndef MISER_MODE
bool default_update = false ;
#elif __WXMAC__
#else
bool default_update = true ;
#endif

#ifdef __WXMAC__
default_update = true ;
#endif

// Loading program options from database
showVectorTitle = LS->getOption ( _T("SHOWVECTORTITLE") , true ) ;
showVectorLength = LS->getOption ( _T("SHOWVECTORLENGTH") , true ) ;
Expand Down Expand Up @@ -234,8 +237,14 @@ void MyFrame::initme ()
// so you won't be bothered with updates anymore :-)
if ( LS->getOption ( _T("DEBUGGING") , _T("") ) == _T("1") ) checkUpdate = false ;

#ifndef __WXMSW__
#ifndef __WXMAC__
checkUpdate = false ;
#endif
#endif

// Check for update online
#ifdef __WXMSW__
//#ifdef __WXMSW__
if ( checkUpdate )
{
wxString cur_update = check4update () ;
Expand All @@ -245,7 +254,7 @@ void MyFrame::initme ()
return ;
}
}
#endif
//#endif

project.name = txt("project") ;
SetTitle ( txt("gentle") ) ;
Expand Down Expand Up @@ -1684,49 +1693,21 @@ bool MyFrame::isActivating ()
*/
wxString MyFrame::check4update ()
{
/* // Deactivated due to strange error message on NT without RAS
wxDialUpManager *dm = wxDialUpManager::Create() ;
if ( dm && dm->IsOk() )
{
if ( !dm->IsOnline() && !dm->IsAlwaysOnline() )
{
delete dm ;
return "" ; // Don't force the poor thing to dial for update
}
}
delete dm ;*/

// miniFrame->SetTitle ( txt("t_checking4update") ) ;

bool error = true ;
wxString text ;

#ifdef __WXMSW__
myExternal ex ;

#ifdef __WXMSW__
text = ex.getText ( _T("http://gentle.magnusmanske.de/currentversion.txt") ) ;
if ( text != _T("") ) error = false ;
#endif

#ifdef __WXMAC__
text = ex.getText ( _T("http://gentle.magnusmanske.de/mac_currentversion.txt") ) ;
#endif


/* wxURL url ( "http://gentle-m.sf.net/currentversion.txt" );
wxInputStream *in_stream;
in_stream = url.GetInputStream();
wxString it , td ;
while ( !in_stream->Eof() ) it += in_stream->GetC() ;
if ( in_stream ) delete in_stream ;*/

/*
wxHTTP http ;
wxInputStream *in = http.GetInputStream ( "http://gentle.magnusmanske.de/currentversion.txt" );
wxString it ;
if ( wxPROTO_NOERR == http.GetError() )
{
while ( !in->Eof() ) it += in->GetC() ;
delete in ;
wxString td = it ;
*/

if ( text != _T("") ) error = false ;

if ( !error )
{
wxString it = text ;
Expand Down Expand Up @@ -1771,20 +1752,46 @@ void MyFrame::update2version ( wxString ver )
wxProgressDialog pd ( _T("Updating...") , _T("Downloading installer...") , 2 , NULL , 0 ) ;
myExternal ex ;
ex.pd = &pd ;
do_run = myapp()->homedir + _T("\\GENtleSetup.exe") ;
if ( ex.copyFile ( _T("http://gentle.magnusmanske.de/GENtleSetup.exe") , do_run ) > 0 )

wxString sourcefile , localfile ;

#ifdef __WXMSW__
localfile = myapp()->homedir + _T("\\GENtleSetup.exe") ;
sourcefile = _T("http://gentle.magnusmanske.de/GENtleSetup.exe") ;
#endif

#ifdef __WXMAC__
localfile = wxString(wxGetUserHome()) + _T("/Desktop/GENtle.pkg.zip") ;
sourcefile = _T("http://gentle.magnusmanske.de/GENtle.pkg.zip") ;
#endif

if ( ex.copyFile ( sourcefile , localfile ) > 0 )
{
wxMessageBox ( _T("Couldn't read setup file") ) ;
return ;
}

do_run = _T("\"") + do_run + _T("\" /S /D=\"") ;
#ifdef __WXMSW__
do_run = _T("\"") + localfile + _T("\" /S /D=\"") ;
do_run += myapp()->homedir ;
do_run += _T("\"") ;
LS->setOption ( _T("LAST_UPDATE") , ver ) ;
dying = true ;
if ( 0 == wxExecute ( do_run , wxEXEC_ASYNC ) ) return ; // 0 means the process couldn't start :-(
wxExit() ; // Hard exit
#endif

#ifdef __WXMAC__
do_run = _T("unzip -o ") + localfile + _T(" -d ") + wxGetUserHome() + _T("/Desktop") ;
wxExecute ( do_run , wxEXEC_SYNC ) ;
wxRemoveFile ( localfile ) ;
localfile = wxString(wxGetUserHome()) + _T("/Desktop/GENtle_package.pkg") ;
do_run = _T("open ") + localfile ;
LS->setOption ( _T("LAST_UPDATE") , ver ) ;
dying = true ;
wxExecute ( do_run , wxEXEC_ASYNC ) ;
Destroy() ;
#endif
}

/** \brief Handles SashDrag events (sash between the main tree and the current child
Expand Down
2 changes: 1 addition & 1 deletion main.h
Expand Up @@ -12,7 +12,7 @@ typedef unsigned int uint ;

/** \fn myass ( bool b , wxString msg )
\brief "My assertion" - little inside joke...
\param b The condition given in the call. No assertion then b is FALSE.
\param b The condition given in the call. No assertion when b is FALSE.
\param msg The message string to write into errout.
*/

Expand Down

0 comments on commit 22e7dd7

Please sign in to comment.