Mac: Determine size of BOINC Manager bundle in core client if it was launched by Manager rather than in the Manager itself, to get correct information when controlling a remote computer.

svn path=/trunk/boinc/; revision=12651
This commit is contained in:
Charlie Fenton 2007-05-11 07:05:29 +00:00
parent 693d450a17
commit 1bf67eddda
5 changed files with 26 additions and 8 deletions

View File

@ -4820,9 +4820,15 @@ Charlie 10 May 2007
drawing into the PieCtrl class itself, greatly simplifying it.
- Mac only: create CViewResources::GetViewRefreshRate() to update
PieCtrl only every 10 seconds to reduce CPU overhead instead of
doing it with a counter in CViewResources::OnListRender().
doing it with a counter in CViewResources::OnListRender().
- Mac: Determine size of BOINC Manager bundle in core client if it was
launched by Manager rather than in the Manager itself, to get
correct information when controlling a remote computer.
client/
gui_rpc_server_ops.C
clientgui/
BOINCGUIApp.cpp, .h
ViewResources.cpp, h
common/
wxPieCtrl.cpp, h

View File

@ -23,6 +23,10 @@
#include "boinc_win.h"
#endif
#ifdef __APPLE__
#include <Carbon/Carbon.h>
#endif
#ifndef _WIN32
#include "config.h"
#include <stdio.h>
@ -124,6 +128,21 @@ static void handle_get_disk_usage(MIOFILE& fout) {
dir_size(".", d_boinc, false);
dir_size("locale", size, false);
d_boinc += size;
#ifdef __APPLE__
if (gstate.launched_by_manager) {
// If launched by Manager, get Manager's size on disk
ProcessSerialNumber managerPSN;
FSRef ourFSRef;
char path[1024];
double manager_size = 0.0;
OSStatus err;
err = GetProcessForPID(getppid(), &managerPSN);
if (! err) err = GetProcessBundleLocation(&managerPSN, &ourFSRef);
if (! err) err = FSRefMakePath (&ourFSRef, (UInt8*)path, sizeof(path));
if (! err) dir_size(path, manager_size, true);
if (! err) d_boinc += manager_size;
}
#endif
fout.printf(
"<d_total>%f</d_total>\n"
"<d_free>%f</d_free>\n"

View File

@ -552,8 +552,6 @@ void CBOINCGUIApp::StartupBOINCCore() {
}
if (err == noErr) {
err = FSRefMakePath (&ourFSRef, (UInt8*)buf, sizeof(buf));
// Get BOINC Manager Bundle Size and save for later use in CViewResources::OnListRender()
dir_size(buf, m_ManagerBundleSize, true);
}
if (err == noErr) {
#if 0 // The Mac version of wxExecute(wxString& ...) crashes if there is a space in the path

View File

@ -119,8 +119,6 @@ public:
#ifdef __WXMAC__
CMacSystemMenu* GetMacSystemMenu() { return m_pMacSystemMenu; }
int GetCurrentGUISelection() { return m_iGUISelected; }
double m_ManagerBundleSize;
double GetManagerBundleSize() { return m_ManagerBundleSize; }
#endif
wxArrayString& GetSupportedLanguages() { return m_astrLanguages; }

View File

@ -231,9 +231,6 @@ void CViewResources::OnListRender( wxTimerEvent& WXUNUSED(event) ) {
m_pieCtrlTotal->m_Series.Add(part);
//used by boinc projects
boinctotal += pDoc->disk_usage.d_boinc;
#ifdef __WXMAC__
boinctotal += wxGetApp().GetManagerBundleSize();
#endif
FormatDiskSpace(boinctotal,diskspace);
part.SetLabel(_("used by BOINC - ") + diskspace);
part.SetValue(boinctotal);