From e0bc069af223e4dd3326eeb84cc2bf2a2a8e2b17 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 12 Dec 2012 14:52:36 -0600 Subject: MAINT-2090 Never enable lighting and shadows by default on OS X --- indra/newview/llfeaturemanager.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index 24a27c5146..7bd21a327e 100644 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -499,6 +499,10 @@ void LLFeatureManager::parseGPUTable(std::string filename) { LL_WARNS("RenderInit") << "GPU '" << rawRenderer << "' not recognized" << LL_ENDL; } + +#if LL_DARWIN // never go over "Mid" settings by default on OS X + mGPUClass = llmin(mGPUClass, 2); +#endif } // responder saves table into file -- cgit v1.2.3 From fd3cbbaa27470de4d8ccbcab608c2a547831d310 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 12 Dec 2012 15:23:50 -0600 Subject: MAINT-2090 Make gcc happy --- indra/newview/llfeaturemanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index 7bd21a327e..17104059f4 100644 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -501,7 +501,7 @@ void LLFeatureManager::parseGPUTable(std::string filename) } #if LL_DARWIN // never go over "Mid" settings by default on OS X - mGPUClass = llmin(mGPUClass, 2); + mGPUClass = llmin(mGPUClass, GPU_CLASS_2); #endif } -- cgit v1.2.3 From ccef9ab2675ad2c2175e0efa431ccad6f312bfb9 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 12 Dec 2012 16:42:06 -0600 Subject: MAINT-2086 Separate GPU class from settings more completely to avoid GPU dependent behavior when manually adjusting detail slider. --- indra/newview/featuretable.txt | 136 ++++++++++++++++++++++++++------- indra/newview/featuretable_linux.txt | 137 +++++++++++++++++++++++++++------- indra/newview/featuretable_mac.txt | 141 +++++++++++++++++++++++++++-------- indra/newview/featuretable_xp.txt | 137 +++++++++++++++++++++++++++------- indra/newview/llfeaturemanager.cpp | 15 +--- 5 files changed, 441 insertions(+), 125 deletions(-) diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt index e877e15053..4030324ecb 100644 --- a/indra/newview/featuretable.txt +++ b/indra/newview/featuretable.txt @@ -97,6 +97,9 @@ RenderUseImpostors 1 1 RenderVolumeLODFactor 1 1.125 VertexShaderEnable 1 0 WindLightUseAtmosShaders 1 0 +RenderDeferred 1 0 +RenderDeferredSSAO 1 0 +RenderShadowDetail 1 0 WLSkyDetail 1 48 RenderFSAASamples 1 0 @@ -126,13 +129,16 @@ RenderUseImpostors 1 1 RenderVolumeLODFactor 1 1.125 VertexShaderEnable 1 1 WindLightUseAtmosShaders 1 0 +RenderDeferred 1 0 +RenderDeferredSSAO 1 0 +RenderShadowDetail 1 0 WLSkyDetail 1 48 RenderFSAASamples 1 0 // -// Mid Graphics Settings +// Medium Low Graphics Settings // -list Mid +list LowMid RenderAnisotropic 1 0 RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 0.5 @@ -153,11 +159,74 @@ RenderUseImpostors 1 1 RenderVolumeLODFactor 1 1.125 VertexShaderEnable 1 1 WindLightUseAtmosShaders 1 0 +RenderDeferred 1 0 +RenderDeferredSSAO 1 0 +RenderShadowDetail 1 0 WLSkyDetail 1 48 RenderFSAASamples 1 0 // -// High Graphics Settings (purty) +// Medium Graphics Settings (standard) +// +list Mid +RenderAnisotropic 1 1 +RenderAvatarCloth 1 0 +RenderAvatarLODFactor 1 1.0 +RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarVP 1 1 +RenderFarClip 1 128 +RenderFlexTimeFactor 1 1.0 +RenderGlowResolutionPow 1 9 +RenderMaxPartCount 1 4096 +RenderObjectBump 1 1 +RenderLocalLights 1 1 +RenderReflectionDetail 1 0 +RenderTerrainDetail 1 1 +RenderTerrainLODFactor 1 2.0 +RenderTransparentWater 1 1 +RenderTreeLODFactor 1 0.5 +RenderUseImpostors 1 1 +RenderVolumeLODFactor 1 1.125 +VertexShaderEnable 1 1 +WindLightUseAtmosShaders 1 1 +RenderDeferred 1 0 +RenderDeferredSSAO 1 0 +RenderShadowDetail 1 0 +WLSkyDetail 1 48 +RenderFSAASamples 1 2 + +// +// Medium High Graphics Settings (deferred enabled) +// +list MidHigh +RenderAnisotropic 1 1 +RenderAvatarCloth 1 0 +RenderAvatarLODFactor 1 1.0 +RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarVP 1 1 +RenderFarClip 1 128 +RenderFlexTimeFactor 1 1.0 +RenderGlowResolutionPow 1 9 +RenderMaxPartCount 1 4096 +RenderObjectBump 1 1 +RenderLocalLights 1 1 +RenderReflectionDetail 1 0 +RenderTerrainDetail 1 1 +RenderTerrainLODFactor 1 2.0 +RenderTransparentWater 1 1 +RenderTreeLODFactor 1 0.5 +RenderUseImpostors 1 1 +RenderVolumeLODFactor 1 1.125 +VertexShaderEnable 1 1 +WindLightUseAtmosShaders 1 1 +RenderDeferred 1 1 +RenderDeferredSSAO 1 0 +RenderShadowDetail 1 0 +WLSkyDetail 1 48 +RenderFSAASamples 1 2 + +// +// High Graphics Settings (deferred + SSAO) // list High RenderAnisotropic 1 1 @@ -180,9 +249,43 @@ RenderUseImpostors 1 1 RenderVolumeLODFactor 1 1.125 VertexShaderEnable 1 1 WindLightUseAtmosShaders 1 1 +RenderDeferred 1 1 +RenderDeferredSSAO 1 1 +RenderShadowDetail 1 0 +WLSkyDetail 1 48 +RenderFSAASamples 1 2 + +// +// High Ultra Graphics Settings (deferred + SSAO + shadows) +// +list HighUltra +RenderAnisotropic 1 1 +RenderAvatarCloth 1 0 +RenderAvatarLODFactor 1 1.0 +RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarVP 1 1 +RenderFarClip 1 128 +RenderFlexTimeFactor 1 1.0 +RenderGlowResolutionPow 1 9 +RenderMaxPartCount 1 4096 +RenderObjectBump 1 1 +RenderLocalLights 1 1 +RenderReflectionDetail 1 0 +RenderTerrainDetail 1 1 +RenderTerrainLODFactor 1 2.0 +RenderTransparentWater 1 1 +RenderTreeLODFactor 1 0.5 +RenderUseImpostors 1 1 +RenderVolumeLODFactor 1 1.125 +VertexShaderEnable 1 1 +WindLightUseAtmosShaders 1 1 +RenderDeferred 1 1 +RenderDeferredSSAO 1 1 +RenderShadowDetail 1 2 WLSkyDetail 1 48 RenderFSAASamples 1 2 + // // Ultra graphics (REALLY PURTY!) // @@ -227,57 +330,36 @@ RenderDeferredSSAO 1 0 // list Class0 RenderVBOEnable 1 1 -RenderShadowDetail 1 0 -RenderDeferred 1 0 -RenderDeferredSSAO 1 0 // // Class 1 Hardware // list Class1 RenderVBOEnable 1 1 -RenderShadowDetail 1 0 -RenderDeferred 1 0 -RenderDeferredSSAO 1 0 - // // Class 2 Hardware // list Class2 RenderVBOEnable 1 1 -RenderShadowDetail 1 0 -RenderDeferred 1 0 -RenderDeferredSSAO 1 0 - // -// Class 3 Hardware (deferred enabled) +// Class 3 Hardware // list Class3 RenderVBOEnable 1 1 -RenderShadowDetail 1 0 -RenderDeferred 1 1 -RenderDeferredSSAO 1 0 // -// Class 4 Hardware (deferred + SSAO) +// Class 4 Hardware // list Class4 RenderVBOEnable 1 1 -RenderShadowDetail 1 0 -RenderDeferred 1 1 -RenderDeferredSSAO 1 1 // -// Class 5 Hardware (deferred + SSAO + shadows) +// Class 5 Hardware // list Class5 RenderVBOEnable 1 1 -RenderShadowDetail 1 2 -RenderDeferred 1 1 -RenderDeferredSSAO 1 1 - // // VRAM > 512MB diff --git a/indra/newview/featuretable_linux.txt b/indra/newview/featuretable_linux.txt index 5699bd9c8a..6d5284c602 100644 --- a/indra/newview/featuretable_linux.txt +++ b/indra/newview/featuretable_linux.txt @@ -94,6 +94,9 @@ RenderUseImpostors 1 1 RenderVolumeLODFactor 1 0.5 VertexShaderEnable 1 1 WindLightUseAtmosShaders 1 0 +RenderDeferred 1 0 +RenderDeferredSSAO 1 0 +RenderShadowDetail 1 0 WLSkyDetail 1 48 RenderFSAASamples 1 0 @@ -122,13 +125,16 @@ RenderUseImpostors 1 1 RenderVolumeLODFactor 1 0.5 VertexShaderEnable 1 0 WindLightUseAtmosShaders 1 0 +RenderDeferred 1 0 +RenderDeferredSSAO 1 0 +RenderShadowDetail 1 0 WLSkyDetail 1 48 RenderFSAASamples 1 0 // -// Mid Graphics Settings +// Medium Low Graphics Settings // -list Mid +list LowMid RenderAnisotropic 1 0 RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 0.5 @@ -137,9 +143,9 @@ RenderAvatarVP 1 1 RenderFarClip 1 96 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 8 -RenderLocalLights 1 1 RenderMaxPartCount 1 2048 RenderObjectBump 1 1 +RenderLocalLights 1 1 RenderReflectionDetail 1 0 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 1.0 @@ -149,11 +155,74 @@ RenderUseImpostors 1 1 RenderVolumeLODFactor 1 1.125 VertexShaderEnable 1 1 WindLightUseAtmosShaders 1 0 +RenderDeferred 1 0 +RenderDeferredSSAO 1 0 +RenderShadowDetail 1 0 WLSkyDetail 1 48 RenderFSAASamples 1 0 // -// High Graphics Settings (purty) +// Medium Graphics Settings (standard) +// +list Mid +RenderAnisotropic 1 1 +RenderAvatarCloth 1 0 +RenderAvatarLODFactor 1 1.0 +RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarVP 1 1 +RenderFarClip 1 128 +RenderFlexTimeFactor 1 1.0 +RenderGlowResolutionPow 1 9 +RenderMaxPartCount 1 4096 +RenderObjectBump 1 1 +RenderLocalLights 1 1 +RenderReflectionDetail 1 0 +RenderTerrainDetail 1 1 +RenderTerrainLODFactor 1 2.0 +RenderTransparentWater 1 1 +RenderTreeLODFactor 1 0.5 +RenderUseImpostors 1 1 +RenderVolumeLODFactor 1 1.125 +VertexShaderEnable 1 1 +WindLightUseAtmosShaders 1 1 +RenderDeferred 1 0 +RenderDeferredSSAO 1 0 +RenderShadowDetail 1 0 +WLSkyDetail 1 48 +RenderFSAASamples 1 2 + +// +// Medium High Graphics Settings (deferred enabled) +// +list MidHigh +RenderAnisotropic 1 1 +RenderAvatarCloth 1 0 +RenderAvatarLODFactor 1 1.0 +RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarVP 1 1 +RenderFarClip 1 128 +RenderFlexTimeFactor 1 1.0 +RenderGlowResolutionPow 1 9 +RenderMaxPartCount 1 4096 +RenderObjectBump 1 1 +RenderLocalLights 1 1 +RenderReflectionDetail 1 0 +RenderTerrainDetail 1 1 +RenderTerrainLODFactor 1 2.0 +RenderTransparentWater 1 1 +RenderTreeLODFactor 1 0.5 +RenderUseImpostors 1 1 +RenderVolumeLODFactor 1 1.125 +VertexShaderEnable 1 1 +WindLightUseAtmosShaders 1 1 +RenderDeferred 1 1 +RenderDeferredSSAO 1 0 +RenderShadowDetail 1 0 +WLSkyDetail 1 48 +RenderFSAASamples 1 2 + +// +// High Graphics Settings (deferred + SSAO) // list High RenderAnisotropic 1 1 @@ -164,9 +233,39 @@ RenderAvatarVP 1 1 RenderFarClip 1 128 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 9 +RenderMaxPartCount 1 4096 +RenderObjectBump 1 1 RenderLocalLights 1 1 +RenderReflectionDetail 1 0 +RenderTerrainDetail 1 1 +RenderTerrainLODFactor 1 2.0 +RenderTransparentWater 1 1 +RenderTreeLODFactor 1 0.5 +RenderUseImpostors 1 1 +RenderVolumeLODFactor 1 1.125 +VertexShaderEnable 1 1 +WindLightUseAtmosShaders 1 1 +RenderDeferred 1 1 +RenderDeferredSSAO 1 1 +RenderShadowDetail 1 0 +WLSkyDetail 1 48 +RenderFSAASamples 1 2 + +// +// High Ultra Graphics Settings (deferred + SSAO + shadows) +// +list HighUltra +RenderAnisotropic 1 1 +RenderAvatarCloth 1 0 +RenderAvatarLODFactor 1 1.0 +RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarVP 1 1 +RenderFarClip 1 128 +RenderFlexTimeFactor 1 1.0 +RenderGlowResolutionPow 1 9 RenderMaxPartCount 1 4096 RenderObjectBump 1 1 +RenderLocalLights 1 1 RenderReflectionDetail 1 0 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 @@ -176,6 +275,9 @@ RenderUseImpostors 1 1 RenderVolumeLODFactor 1 1.125 VertexShaderEnable 1 1 WindLightUseAtmosShaders 1 1 +RenderDeferred 1 1 +RenderDeferredSSAO 1 1 +RenderShadowDetail 1 2 WLSkyDetail 1 48 RenderFSAASamples 1 2 @@ -223,56 +325,37 @@ RenderDeferredSSAO 1 0 // list Class0 RenderVBOEnable 1 1 -RenderShadowDetail 1 0 -RenderDeferred 1 0 -RenderDeferredSSAO 1 0 // // Class 1 Hardware // list Class1 RenderVBOEnable 1 1 -RenderShadowDetail 1 0 -RenderDeferred 1 0 -RenderDeferredSSAO 1 0 - // // Class 2 Hardware // list Class2 RenderVBOEnable 1 1 -RenderShadowDetail 1 0 -RenderDeferred 1 0 -RenderDeferredSSAO 1 0 - // -// Class 3 Hardware (deferred enabled) +// Class 3 Hardware // list Class3 RenderVBOEnable 1 1 -RenderShadowDetail 1 0 -RenderDeferred 1 1 -RenderDeferredSSAO 1 0 // -// Class 4 Hardware (deferred + SSAO) +// Class 4 Hardware // list Class4 RenderVBOEnable 1 1 -RenderShadowDetail 1 0 -RenderDeferred 1 1 -RenderDeferredSSAO 1 1 // -// Class 5 Hardware (deferred + SSAO + shadows) +// Class 5 Hardware // list Class5 RenderVBOEnable 1 1 -RenderShadowDetail 1 2 -RenderDeferred 1 1 -RenderDeferredSSAO 1 1 + // // VRAM > 512MB // diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt index 3a91f19c58..eb1a4c78a3 100644 --- a/indra/newview/featuretable_mac.txt +++ b/indra/newview/featuretable_mac.txt @@ -96,6 +96,9 @@ RenderUseImpostors 1 1 RenderVolumeLODFactor 1 0.5 VertexShaderEnable 1 0 WindLightUseAtmosShaders 1 0 +RenderDeferred 1 0 +RenderDeferredSSAO 1 0 +RenderShadowDetail 1 0 WLSkyDetail 1 48 RenderFSAASamples 1 0 @@ -124,13 +127,16 @@ RenderUseImpostors 1 1 RenderVolumeLODFactor 1 0.5 VertexShaderEnable 1 1 WindLightUseAtmosShaders 1 0 +RenderDeferred 1 0 +RenderDeferredSSAO 1 0 +RenderShadowDetail 1 0 WLSkyDetail 1 48 RenderFSAASamples 1 0 // -// Mid Graphics Settings +// Medium Low Graphics Settings // -list Mid +list LowMid RenderAnisotropic 1 0 RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 0.5 @@ -139,9 +145,9 @@ RenderAvatarVP 1 1 RenderFarClip 1 96 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 8 -RenderLocalLights 1 1 RenderMaxPartCount 1 2048 RenderObjectBump 1 1 +RenderLocalLights 1 1 RenderReflectionDetail 1 0 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 1.0 @@ -151,11 +157,74 @@ RenderUseImpostors 1 1 RenderVolumeLODFactor 1 1.125 VertexShaderEnable 1 1 WindLightUseAtmosShaders 1 0 +RenderDeferred 1 0 +RenderDeferredSSAO 1 0 +RenderShadowDetail 1 0 WLSkyDetail 1 48 RenderFSAASamples 1 0 // -// High Graphics Settings (purty) +// Medium Graphics Settings (standard) +// +list Mid +RenderAnisotropic 1 1 +RenderAvatarCloth 1 0 +RenderAvatarLODFactor 1 1.0 +RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarVP 1 1 +RenderFarClip 1 128 +RenderFlexTimeFactor 1 1.0 +RenderGlowResolutionPow 1 9 +RenderMaxPartCount 1 4096 +RenderObjectBump 1 1 +RenderLocalLights 1 1 +RenderReflectionDetail 1 0 +RenderTerrainDetail 1 1 +RenderTerrainLODFactor 1 2.0 +RenderTransparentWater 1 1 +RenderTreeLODFactor 1 0.5 +RenderUseImpostors 1 1 +RenderVolumeLODFactor 1 1.125 +VertexShaderEnable 1 1 +WindLightUseAtmosShaders 1 1 +RenderDeferred 1 0 +RenderDeferredSSAO 1 0 +RenderShadowDetail 1 0 +WLSkyDetail 1 48 +RenderFSAASamples 1 2 + +// +// Medium High Graphics Settings (deferred enabled) +// +list MidHigh +RenderAnisotropic 1 1 +RenderAvatarCloth 1 0 +RenderAvatarLODFactor 1 1.0 +RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarVP 1 1 +RenderFarClip 1 128 +RenderFlexTimeFactor 1 1.0 +RenderGlowResolutionPow 1 9 +RenderMaxPartCount 1 4096 +RenderObjectBump 1 1 +RenderLocalLights 1 1 +RenderReflectionDetail 1 0 +RenderTerrainDetail 1 1 +RenderTerrainLODFactor 1 2.0 +RenderTransparentWater 1 1 +RenderTreeLODFactor 1 0.5 +RenderUseImpostors 1 1 +RenderVolumeLODFactor 1 1.125 +VertexShaderEnable 1 1 +WindLightUseAtmosShaders 1 1 +RenderDeferred 1 1 +RenderDeferredSSAO 1 0 +RenderShadowDetail 1 0 +WLSkyDetail 1 48 +RenderFSAASamples 1 2 + +// +// High Graphics Settings (deferred + SSAO) // list High RenderAnisotropic 1 1 @@ -166,9 +235,39 @@ RenderAvatarVP 1 1 RenderFarClip 1 128 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 9 +RenderMaxPartCount 1 4096 +RenderObjectBump 1 1 RenderLocalLights 1 1 +RenderReflectionDetail 1 0 +RenderTerrainDetail 1 1 +RenderTerrainLODFactor 1 2.0 +RenderTransparentWater 1 1 +RenderTreeLODFactor 1 0.5 +RenderUseImpostors 1 1 +RenderVolumeLODFactor 1 1.125 +VertexShaderEnable 1 1 +WindLightUseAtmosShaders 1 1 +RenderDeferred 1 1 +RenderDeferredSSAO 1 1 +RenderShadowDetail 1 0 +WLSkyDetail 1 48 +RenderFSAASamples 1 2 + +// +// High Ultra Graphics Settings (deferred + SSAO + shadows) +// +list HighUltra +RenderAnisotropic 1 1 +RenderAvatarCloth 1 0 +RenderAvatarLODFactor 1 1.0 +RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarVP 1 1 +RenderFarClip 1 128 +RenderFlexTimeFactor 1 1.0 +RenderGlowResolutionPow 1 9 RenderMaxPartCount 1 4096 RenderObjectBump 1 1 +RenderLocalLights 1 1 RenderReflectionDetail 1 0 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 @@ -178,9 +277,13 @@ RenderUseImpostors 1 1 RenderVolumeLODFactor 1 1.125 VertexShaderEnable 1 1 WindLightUseAtmosShaders 1 1 +RenderDeferred 1 1 +RenderDeferredSSAO 1 1 +RenderShadowDetail 1 2 WLSkyDetail 1 48 RenderFSAASamples 1 2 + // // Ultra graphics (REALLY PURTY!) // @@ -216,65 +319,41 @@ RenderFSAASamples 1 2 // list Unknown RenderVBOEnable 1 0 -RenderShadowDetail 1 0 -RenderDeferred 1 0 -RenderDeferredSSAO 1 0 // // Class 0 Hardware (just old) // list Class0 RenderVBOEnable 1 1 -RenderShadowDetail 1 0 -RenderDeferred 1 0 -RenderDeferredSSAO 1 0 // // Class 1 Hardware // list Class1 RenderVBOEnable 1 1 -RenderShadowDetail 1 0 -RenderDeferred 1 0 -RenderDeferredSSAO 1 0 - // // Class 2 Hardware // list Class2 RenderVBOEnable 1 1 -RenderShadowDetail 1 0 -RenderDeferred 1 0 -RenderDeferredSSAO 1 0 - // -// Class 3 Hardware (deferred enabled) +// Class 3 Hardware // list Class3 RenderVBOEnable 1 1 -RenderShadowDetail 1 0 -RenderDeferred 1 1 -RenderDeferredSSAO 1 0 - // -// Class 4 Hardware (deferred + SSAO) +// Class 4 Hardware // list Class4 RenderVBOEnable 1 1 -RenderShadowDetail 1 0 -RenderDeferred 1 1 -RenderDeferredSSAO 1 1 // -// Class 5 Hardware (deferred + SSAO + shadows) +// Class 5 Hardware // list Class5 RenderVBOEnable 1 1 -RenderShadowDetail 1 2 -RenderDeferred 1 1 -RenderDeferredSSAO 1 1 // // No Pixel Shaders available diff --git a/indra/newview/featuretable_xp.txt b/indra/newview/featuretable_xp.txt index ad16e2533b..68e09d010e 100644 --- a/indra/newview/featuretable_xp.txt +++ b/indra/newview/featuretable_xp.txt @@ -96,6 +96,9 @@ RenderUseImpostors 1 1 RenderVolumeLODFactor 1 0.5 VertexShaderEnable 1 0 WindLightUseAtmosShaders 1 0 +RenderDeferred 1 0 +RenderDeferredSSAO 1 0 +RenderShadowDetail 1 0 WLSkyDetail 1 48 RenderFSAASamples 1 0 @@ -124,13 +127,16 @@ RenderUseImpostors 1 1 RenderVolumeLODFactor 1 0.5 VertexShaderEnable 1 1 WindLightUseAtmosShaders 1 0 +RenderDeferred 1 0 +RenderDeferredSSAO 1 0 +RenderShadowDetail 1 0 WLSkyDetail 1 48 RenderFSAASamples 1 0 // -// Mid Graphics Settings +// Medium Low Graphics Settings // -list Mid +list LowMid RenderAnisotropic 1 0 RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 0.5 @@ -139,9 +145,9 @@ RenderAvatarVP 1 1 RenderFarClip 1 96 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 8 -RenderLocalLights 1 1 RenderMaxPartCount 1 2048 RenderObjectBump 1 1 +RenderLocalLights 1 1 RenderReflectionDetail 1 0 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 1.0 @@ -151,11 +157,74 @@ RenderUseImpostors 1 1 RenderVolumeLODFactor 1 1.125 VertexShaderEnable 1 1 WindLightUseAtmosShaders 1 0 +RenderDeferred 1 0 +RenderDeferredSSAO 1 0 +RenderShadowDetail 1 0 WLSkyDetail 1 48 RenderFSAASamples 1 0 // -// High Graphics Settings (purty) +// Medium Graphics Settings (standard) +// +list Mid +RenderAnisotropic 1 1 +RenderAvatarCloth 1 0 +RenderAvatarLODFactor 1 1.0 +RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarVP 1 1 +RenderFarClip 1 128 +RenderFlexTimeFactor 1 1.0 +RenderGlowResolutionPow 1 9 +RenderMaxPartCount 1 4096 +RenderObjectBump 1 1 +RenderLocalLights 1 1 +RenderReflectionDetail 1 0 +RenderTerrainDetail 1 1 +RenderTerrainLODFactor 1 2.0 +RenderTransparentWater 1 1 +RenderTreeLODFactor 1 0.5 +RenderUseImpostors 1 1 +RenderVolumeLODFactor 1 1.125 +VertexShaderEnable 1 1 +WindLightUseAtmosShaders 1 1 +RenderDeferred 1 0 +RenderDeferredSSAO 1 0 +RenderShadowDetail 1 0 +WLSkyDetail 1 48 +RenderFSAASamples 1 2 + +// +// Medium High Graphics Settings (deferred enabled) +// +list MidHigh +RenderAnisotropic 1 1 +RenderAvatarCloth 1 0 +RenderAvatarLODFactor 1 1.0 +RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarVP 1 1 +RenderFarClip 1 128 +RenderFlexTimeFactor 1 1.0 +RenderGlowResolutionPow 1 9 +RenderMaxPartCount 1 4096 +RenderObjectBump 1 1 +RenderLocalLights 1 1 +RenderReflectionDetail 1 0 +RenderTerrainDetail 1 1 +RenderTerrainLODFactor 1 2.0 +RenderTransparentWater 1 1 +RenderTreeLODFactor 1 0.5 +RenderUseImpostors 1 1 +RenderVolumeLODFactor 1 1.125 +VertexShaderEnable 1 1 +WindLightUseAtmosShaders 1 1 +RenderDeferred 1 1 +RenderDeferredSSAO 1 0 +RenderShadowDetail 1 0 +WLSkyDetail 1 48 +RenderFSAASamples 1 2 + +// +// High Graphics Settings (deferred + SSAO) // list High RenderAnisotropic 1 1 @@ -166,9 +235,39 @@ RenderAvatarVP 1 1 RenderFarClip 1 128 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 9 +RenderMaxPartCount 1 4096 +RenderObjectBump 1 1 RenderLocalLights 1 1 +RenderReflectionDetail 1 0 +RenderTerrainDetail 1 1 +RenderTerrainLODFactor 1 2.0 +RenderTransparentWater 1 1 +RenderTreeLODFactor 1 0.5 +RenderUseImpostors 1 1 +RenderVolumeLODFactor 1 1.125 +VertexShaderEnable 1 1 +WindLightUseAtmosShaders 1 1 +RenderDeferred 1 1 +RenderDeferredSSAO 1 1 +RenderShadowDetail 1 0 +WLSkyDetail 1 48 +RenderFSAASamples 1 2 + +// +// High Ultra Graphics Settings (deferred + SSAO + shadows) +// +list HighUltra +RenderAnisotropic 1 1 +RenderAvatarCloth 1 0 +RenderAvatarLODFactor 1 1.0 +RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarVP 1 1 +RenderFarClip 1 128 +RenderFlexTimeFactor 1 1.0 +RenderGlowResolutionPow 1 9 RenderMaxPartCount 1 4096 RenderObjectBump 1 1 +RenderLocalLights 1 1 RenderReflectionDetail 1 0 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 @@ -178,6 +277,9 @@ RenderUseImpostors 1 1 RenderVolumeLODFactor 1 1.125 VertexShaderEnable 1 1 WindLightUseAtmosShaders 1 1 +RenderDeferred 1 1 +RenderDeferredSSAO 1 1 +RenderShadowDetail 1 2 WLSkyDetail 1 48 RenderFSAASamples 1 2 @@ -216,65 +318,42 @@ RenderFSAASamples 1 2 // list Unknown RenderVBOEnable 1 0 -RenderShadowDetail 1 0 -RenderDeferred 1 0 -RenderDeferredSSAO 1 0 // // Class 0 Hardware (just old) // list Class0 RenderVBOEnable 1 1 -RenderShadowDetail 1 0 -RenderDeferred 1 0 -RenderDeferredSSAO 1 0 // // Class 1 Hardware // list Class1 RenderVBOEnable 1 1 -RenderShadowDetail 1 0 -RenderDeferred 1 0 -RenderDeferredSSAO 1 0 - // // Class 2 Hardware // list Class2 RenderVBOEnable 1 1 -RenderShadowDetail 1 0 -RenderDeferred 1 0 -RenderDeferredSSAO 1 0 - // -// Class 3 Hardware (deferred enabled) +// Class 3 Hardware // list Class3 RenderVBOEnable 1 1 -RenderShadowDetail 1 0 -RenderDeferred 1 1 -RenderDeferredSSAO 1 0 // // Class 4 Hardware (deferred + SSAO) // list Class4 RenderVBOEnable 1 1 -RenderShadowDetail 1 0 -RenderDeferred 1 1 -RenderDeferredSSAO 1 1 // -// Class 5 Hardware (deferred + SSAO + shadows) +// Class 5 Hardware // list Class5 RenderVBOEnable 1 1 -RenderShadowDetail 1 2 -RenderDeferred 1 1 -RenderDeferredSSAO 1 1 // // VRAM > 512MB diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index 17104059f4..2b39b771e7 100644 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -712,34 +712,27 @@ void LLFeatureManager::setGraphicsLevel(S32 level, bool skipFeatures) { //same as low, but with "Basic Shaders" enabled maskFeatures("Low"); } - maskFeatures("Class0"); break; case 1: - maskFeatures("Mid"); - maskFeatures("Class1"); + maskFeatures("LowMid"); break; case 2: - maskFeatures("High"); - maskFeatures("Class2"); + maskFeatures("Mid"); break; case 3: - maskFeatures("High"); - maskFeatures("Class3"); + maskFeatures("MidHigh"); break; case 4: maskFeatures("High"); - maskFeatures("Class4"); break; case 5: - maskFeatures("High"); - maskFeatures("Class5"); + maskFeatures("HighUltra"); break; case 6: maskFeatures("Ultra"); break; default: maskFeatures("Low"); - maskFeatures("Class0"); break; } -- cgit v1.2.3 From 87b248958cee6476a21c18911cd7c14bb270763e Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 12 Dec 2012 17:17:56 -0600 Subject: MAINT-2090 Bump featuretable version to reset mac graphics to default --- indra/newview/featuretable_mac.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt index eb1a4c78a3..1c0d45c11b 100644 --- a/indra/newview/featuretable_mac.txt +++ b/indra/newview/featuretable_mac.txt @@ -1,4 +1,4 @@ -version 34 +version 35 // The version number above should be implemented IF AND ONLY IF some // change has been made that is sufficiently important to justify // resetting the graphics preferences of all users to the recommended -- cgit v1.2.3 From 81ba7e031e522e38fca760861a710f7527edecdd Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 5 Dec 2012 18:27:13 -0600 Subject: MAINT-1760 Fix for opaque water glowing when wearing certain rigged attachments. --- indra/newview/lldrawpoolavatar.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 730ad1a364..0e15f474c9 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -1630,6 +1630,7 @@ void LLDrawPoolAvatar::renderRiggedAlpha(LLVOAvatar* avatar) LLRender::BF_ONE_MINUS_SOURCE_ALPHA); renderRigged(avatar, RIGGED_ALPHA); + gGL.setColorMask(true, false); } } @@ -1646,6 +1647,7 @@ void LLDrawPoolAvatar::renderRiggedFullbrightAlpha(LLVOAvatar* avatar) LLRender::BF_ONE_MINUS_SOURCE_ALPHA); renderRigged(avatar, RIGGED_FULLBRIGHT_ALPHA); + gGL.setColorMask(true, false); } } -- cgit v1.2.3 From 9db74ae962ad0c8864f8b236bed0bb503b0e96e1 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 9 Oct 2012 18:27:42 -0500 Subject: MAINT-1138 Fix for crash when picking rigged attachments. --- doc/contributions.txt | 3 +++ indra/newview/llvovolume.cpp | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/contributions.txt b/doc/contributions.txt index f18985adcd..3a543db173 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -1059,9 +1059,12 @@ Shawn Kaufmat SNOW-240 Sheet Spotter Shnurui Troughton +Shyotl Kuhr + MAINT-1138 Siana Gearz STORM-960 STORM-1088 + MAINT-1138 sicarius Thorne Sicarius Toxx SignpostMarv Martin diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 5d1c335078..538911e9b8 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1483,7 +1483,7 @@ BOOL LLVOVolume::genBBoxes(BOOL force_global) updateRadius(); mDrawable->movePartition(); - + return res; } @@ -3583,7 +3583,6 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& e if (LLFloater::isVisible(gFloaterTools) && getAvatar()->isSelf()) { updateRiggedVolume(); - genBBoxes(FALSE); volume = mRiggedVolume; transform = false; } -- cgit v1.2.3 From 2fd843c11884ea7543544d5f33bc7030655b7382 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 17 Oct 2012 15:33:01 -0500 Subject: MAINT-873 Fix for inability to upload meshes on some systems. --- doc/contributions.txt | 4 ++++ indra/newview/llmeshrepository.cpp | 33 ++++++++++++++++++++++++++++----- indra/newview/llmeshrepository.h | 3 +++ 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/doc/contributions.txt b/doc/contributions.txt index 3a543db173..f53d9f5cfd 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -321,6 +321,7 @@ Dale Glass VWR-1358 VWR-2041 Darien Caldwell + SH-3055 Dartagan Shepherd Debs Regent Decro Schmooz @@ -890,6 +891,8 @@ Nicholaz Beresford VWR-2682 VWR-2684 Nick Rhodes +NickyD + MAINT-873 Nicky Dasmijn VWR-29228 Nicky Perian @@ -1246,6 +1249,7 @@ Westley Streeter Whimsy Winx Whirly Fizzle STORM-1895 + MAINT-873 Whoops Babii VWR-631 VWR-1640 diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index ba0a590910..92ac435f08 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -361,7 +361,20 @@ public: mModelData(model_data), mObserverHandle(observer_handle) { + if (mThread) + { + mThread->startRequest(); + } + } + + ~LLWholeModelFeeResponder() + { + if (mThread) + { + mThread->stopRequest(); + } } + virtual void completed(U32 status, const std::string& reason, const LLSD& content) @@ -372,7 +385,6 @@ public: cc = llsd_from_file("fake_upload_error.xml"); } - mThread->mPendingUploads--; dump_llsd_to_file(cc,make_dump_name("whole_model_fee_response_",dump_num)); LLWholeModelFeeObserver* observer = mObserverHandle.get(); @@ -415,7 +427,20 @@ public: mModelData(model_data), mObserverHandle(observer_handle) { + if (mThread) + { + mThread->startRequest(); + } + } + + ~LLWholeModelUploadResponder() + { + if (mThread) + { + mThread->stopRequest(); + } } + virtual void completed(U32 status, const std::string& reason, const LLSD& content) @@ -426,7 +451,6 @@ public: cc = llsd_from_file("fake_upload_error.xml"); } - mThread->mPendingUploads--; dump_llsd_to_file(cc,make_dump_name("whole_model_upload_response_",dump_num)); LLWholeModelUploadObserver* observer = mObserverHandle.get(); @@ -1622,7 +1646,7 @@ void LLMeshUploadThread::doWholeModelUpload() mCurlRequest->process(); //sleep for 10ms to prevent eating a whole core apr_sleep(10000); - } while (!LLAppViewer::isQuitting() && mCurlRequest->getQueued() > 0); + } while (!LLAppViewer::isQuitting() && mPendingUploads > 0); } delete mCurlRequest; @@ -1644,7 +1668,6 @@ void LLMeshUploadThread::requestWholeModelFee() wholeModelToLLSD(model_data,false); dump_llsd_to_file(model_data,make_dump_name("whole_model_fee_request_",dump_num)); - mPendingUploads++; LLCurlRequest::headers_t headers; { @@ -1661,7 +1684,7 @@ void LLMeshUploadThread::requestWholeModelFee() mCurlRequest->process(); //sleep for 10ms to prevent eating a whole core apr_sleep(10000); - } while (!LLApp::isQuitting() && mCurlRequest->getQueued() > 0); + } while (!LLApp::isQuitting() && mPendingUploads > 0); delete mCurlRequest; mCurlRequest = NULL; diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index da81bb057b..6e301c26a2 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -405,6 +405,9 @@ public: LLHandle fee_observer= (LLHandle()), LLHandle upload_observer = (LLHandle())); ~LLMeshUploadThread(); + void startRequest() { ++mPendingUploads; } + void stopRequest() { --mPendingUploads; } + bool finished() { return mFinished; } virtual void run(); void preStart(); -- cgit v1.2.3 From a03b654797f80ebc4b3660930acbed55a7fc2ce2 Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Mon, 12 Nov 2012 16:21:07 -0800 Subject: Mac updater changes ported from another branch. --- indra/mac_updater/AutoUpdater.xib | 520 +++++++++ indra/mac_updater/CMakeLists.txt | 23 +- indra/mac_updater/MacUpdater-Info.plist | 30 + indra/mac_updater/MacUpdaterAppDelegate.h | 58 + indra/mac_updater/MacUpdaterAppDelegate.mm | 274 +++++ indra/mac_updater/mac_updater.cpp | 1578 +++++++++------------------- indra/mac_updater/mac_updater.h | 89 ++ indra/mac_updater/main.m | 34 + 8 files changed, 1513 insertions(+), 1093 deletions(-) create mode 100644 indra/mac_updater/AutoUpdater.xib create mode 100644 indra/mac_updater/MacUpdater-Info.plist create mode 100644 indra/mac_updater/MacUpdaterAppDelegate.h create mode 100644 indra/mac_updater/MacUpdaterAppDelegate.mm create mode 100644 indra/mac_updater/mac_updater.h create mode 100644 indra/mac_updater/main.m diff --git a/indra/mac_updater/AutoUpdater.xib b/indra/mac_updater/AutoUpdater.xib new file mode 100644 index 0000000000..b29fffba3a --- /dev/null +++ b/indra/mac_updater/AutoUpdater.xib @@ -0,0 +1,520 @@ + + + + 1070 + 11G63 + 2182 + 1138.51 + 569.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 2182 + + + NSTextField + NSView + NSWindowTemplate + NSProgressIndicator + NSCustomObject + IBNSLayoutConstraint + NSButtonCell + NSButton + NSUserDefaultsController + NSTextFieldCell + + + com.apple.InterfaceBuilder.CocoaPlugin + + + PluginDependencyRecalculationVersion + + + + + NSObject + + + FirstResponder + + + NSApplication + + + 15 + 2 + {{196, 240}, {402, 120}} + 544735232 + Window + NSWindow + + + + + 256 + + + + 268 + {{17, 83}, {79, 17}} + + + + _NS:1505 + YES + + 68288064 + 272630784 + Initalizing... + + LucidaGrande + 13 + 1044 + + _NS:1505 + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2NjY3AA + + + + 6 + System + controlTextColor + + 3 + MAA + + + + + + + 268 + {{18, 55}, {366, 20}} + + + + _NS:9 + {250, 250} + 16399 + 100 + + + + 268 + {{308, 19}, {74, 19}} + + + + _NS:9 + YES + + -2080244224 + 134217728 + Cancel + + LucidaGrande + 12 + 16 + + _NS:9 + + -2038152961 + 164 + + + 400 + 75 + + + + {402, 120} + + + + + {{0, 0}, {1680, 1028}} + {10000000000000, 10000000000000} + YES + + + MacUpdaterAppDelegate + + + YES + + + + + + + title: values + + + + + + title: values + title + values + 2 + + + 41 + + + + + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 1 + + + + + + + + 2 + + + + + + + 5 + 0 + + 5 + 1 + + 20 + + 1000 + 8 + 29 + 3 + + + + + 5 + 0 + + 5 + 1 + + 20 + + 1000 + 8 + 29 + 3 + + + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + 8 + 29 + 3 + + + + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + 8 + 29 + 3 + + + + + 3 + 0 + + 3 + 1 + + 20 + + 1000 + 8 + 29 + 3 + + + + + 3 + 0 + + 4 + 1 + + 8 + + 1000 + 6 + 24 + 3 + + + + + 4 + 0 + + 4 + 1 + + 20 + + 1000 + 8 + 29 + 3 + + + + + + + 3 + + + + + + + + 4 + + + + + 8 + + + + + + 20 + + + + + 22 + + + + + + 7 + 0 + + 0 + 1 + + 74 + + 1000 + 3 + 9 + 1 + + + + + + + 23 + + + + + 31 + + + + + 32 + + + + + 35 + + + + + 36 + + + + + 37 + + + + + 38 + + + + + 39 + + + + + 40 + + + + + 42 + + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{357, 418}, {480, 270}} + + + + + + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + + 42 + + + + + MacUpdaterAppDelegate + NSObject + + cancel: + id + + + cancel: + + cancel: + id + + + + NSProgressIndicator + NSTextField + NSWindow + + + + mProgressBar + NSProgressIndicator + + + mProgressText + NSTextField + + + window + NSWindow + + + + IBProjectSource + ./Classes/MacUpdaterAppDelegate.h + + + + + 0 + IBCocoaFramework + YES + 3 + YES + + diff --git a/indra/mac_updater/CMakeLists.txt b/indra/mac_updater/CMakeLists.txt index 00dcedecaa..aa70e64b71 100644 --- a/indra/mac_updater/CMakeLists.txt +++ b/indra/mac_updater/CMakeLists.txt @@ -18,10 +18,14 @@ include_directories( ) set(mac_updater_SOURCE_FILES - mac_updater.cpp + main.m + MacUpdaterAppDelegate.mm + mac_updater.cpp ) set(mac_updater_HEADER_FILES + MacUpdaterAppDelegate.h + mac_updater.h CMakeLists.txt ) @@ -32,7 +36,7 @@ list(APPEND mac_updater_SOURCE_FILES ${mac_updater_HEADER_FILES}) set(mac_updater_RESOURCE_FILES - AutoUpdater.nib/ + AutoUpdater.nib ) set_source_files_properties( ${mac_updater_RESOURCE_FILES} @@ -48,13 +52,18 @@ add_executable(mac-updater set_target_properties(mac-updater PROPERTIES - MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist + MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/MacUpdater-Info.plist ) +find_library(COCOA_LIBRARY Cocoa) +find_library(IOKIT_LIBRARY IOKit) + target_link_libraries(mac-updater ${LLVFS_LIBRARIES} ${OPENSSL_LIBRARIES} ${CRYPTO_LIBRARIES} + ${COCOA_LIBRARIES} + ${IOKIT_LIBRARY} ${CURL_LIBRARIES} ${CARES_LIBRARIES} ${LLCOMMON_LIBRARIES} @@ -62,10 +71,16 @@ target_link_libraries(mac-updater add_custom_command( TARGET mac-updater POST_BUILD +# COMMAND ${CMAKE_COMMAND} +# ARGS +# -E +# copy_directory +# ${CMAKE_CURRENT_SOURCE_DIR}/AutoUpdater.nib +# ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mac-updater.app/Contents/Resources/AutoUpdater.nib COMMAND ${CMAKE_COMMAND} ARGS -E - copy_directory + copy ${CMAKE_CURRENT_SOURCE_DIR}/AutoUpdater.nib ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mac-updater.app/Contents/Resources/AutoUpdater.nib ) diff --git a/indra/mac_updater/MacUpdater-Info.plist b/indra/mac_updater/MacUpdater-Info.plist new file mode 100644 index 0000000000..92137095ff --- /dev/null +++ b/indra/mac_updater/MacUpdater-Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + mac-updater + CFBundleGetInfoString + + CFBundleIconFile + + CFBundleIdentifier + com.secondlife.indra.autoupdater + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleShortVersionString + + CFBundleSignature + ???? + CFBundleVersion + 1.0.0 + NSMainNibFile + AutoUpdater + NSPrincipalClass + NSApplication + + diff --git a/indra/mac_updater/MacUpdaterAppDelegate.h b/indra/mac_updater/MacUpdaterAppDelegate.h new file mode 100644 index 0000000000..ba5744b398 --- /dev/null +++ b/indra/mac_updater/MacUpdaterAppDelegate.h @@ -0,0 +1,58 @@ +/** + * @file MacUpdaterAppDelegate.h + * @brief + * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + + +#import +#include +#include "mac_updater.h" + +#ifndef LL_MAC_UPDATE_DELEGATE_H +#define LL_MAC_UPDATE_DELEGATE_H + +@interface MacUpdaterAppDelegate : NSObject +{ + IBOutlet NSProgressIndicator *mProgressBar; + IBOutlet NSTextField *mProgressText; +} +- (void)setWindow:(NSWindow *)newWindow; +- (NSWindow *)window; +- (IBAction)cancel:(id)sender; +- (void) setProgress:(int)cur max:(int) max; +- (void) setProgressText:(const std::string&)str; +- (int) parse_args:(NSArray *) args; +- (void)stopAlert; +- (void)stopAlertDidEnd:(NSAlert *)alert returnCode:(int)returnCode contextInfo:(void *)contextInfo; + + +NSWindow *_window; +bool mAnimated; +double mProgressPercentage; +@property (assign) IBOutlet NSWindow *window; +LLMacUpdater mUpdater; + +@end + +#endif //LL_MAC_UPDATE_DELEGATE_H \ No newline at end of file diff --git a/indra/mac_updater/MacUpdaterAppDelegate.mm b/indra/mac_updater/MacUpdaterAppDelegate.mm new file mode 100644 index 0000000000..80206cb508 --- /dev/null +++ b/indra/mac_updater/MacUpdaterAppDelegate.mm @@ -0,0 +1,274 @@ +/** + * @file MacUpdaterAppDelegate.mm + * @brief + * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#import "MacUpdaterAppDelegate.h" +#include "llvfs_objc.h" +#include +#include + +@implementation MacUpdaterAppDelegate + +MacUpdaterAppDelegate *gWindow; +bool gCancelled = false; +bool gFailure =false; + + +//@synthesize window = _window; +- (void)setWindow:(NSWindow *)window +{ + _window = window; +} + +- (NSWindow *)window +{ + return _window; +} + +- (id)init +{ + self = [super init]; + if (self) { + + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + mAnimated = false; + mProgressPercentage = 0.0; + NSArray *arguments = [[NSProcessInfo processInfo] arguments]; + + [self parse_args:arguments]; + gWindow = self; + + mUpdater.doUpdate(); + [pool drain]; + [pool release]; + } + return self; +} + +- (void)dealloc +{ + [super dealloc]; +} + +std::string* NSToString( NSString *ns_str ) +{ + return ( new std::string([ns_str UTF8String]) ); +} + + +- (void) setProgress:(int)cur max:(int) max +{ + bool indeterminate = false; + if (max==0) + { + indeterminate = true; + } + else + { + double percentage = ((double)cur / (double)max) * 100.0; + [mProgressBar setDoubleValue:percentage]; + } + [mProgressBar setIndeterminate:indeterminate]; +} + +- (void) setProgressText:(const std::string& )str +{ + [mProgressText setStringValue:[NSString stringWithUTF8String:str.c_str()]]; +} + +void sendDone() +{ + [ [ (id) gWindow window ] close]; +} + +void sendStopAlert() +{ + [ gWindow stopAlert ]; +} + +void setProgress(int cur, int max) +{ + [ (id) gWindow setProgress:cur max:max]; +} + +void setProgressText(const std::string& str) +{ + [ (id) gWindow setProgressText:str]; +} + +void sendProgress(int cur, int max, const std::string str) +{ + setProgress(cur,max); + setProgressText(str); +} + +bool mkTempDir(boost::filesystem::path& temp_dir) +{ + NSString * tempDir = NSTemporaryDirectory(); + if (tempDir == nil) + tempDir = @"/tmp/"; + + std::string* temp_str = NSToString(tempDir); + *temp_str += std::string("SecondLifeUpdate_XXXXXX"); + + std::cout << "tempDir is " << temp_str << std::endl; + + char temp[PATH_MAX] = ""; /* Flawfinder: ignore */ + strncpy(temp, temp_str->c_str(), temp_str->length()); + + if(mkdtemp(temp) == NULL) + { + return false; + } + + temp_dir = boost::filesystem::path(temp); + + delete temp_str; + + return true; +} + +bool copyDir(const std::string& src_dir, const std::string& dest_dir) +{ + NSString* file = [NSString stringWithCString:src_dir.c_str() + encoding:[NSString defaultCStringEncoding]]; + NSString* toParent = [NSString stringWithCString:dest_dir.c_str() + encoding:[NSString defaultCStringEncoding]]; + NSError* error = nil; + + bool result = [[NSFileManager defaultManager] copyItemAtPath: file toPath: toParent error:&error]; + + if (!result) { + NSLog(@"Error during copy: %@", [error localizedDescription]); + } + return result; +} + +- (int) parse_args:(NSArray *) args +{ + int i; + int argc = [args count]; + + mUpdater.mApplicationPath = NSToString( [args objectAtIndex:0] ); + + for( i = 1; i < argc; i++ ) + { + NSString* ns_arg = [args objectAtIndex:i]; + const char *arg = [ns_arg UTF8String]; + + if ((!strcmp(arg, "-url")) && (i < argc)) + { + mUpdater.mUpdateURL = NSToString( [args objectAtIndex:(++i)] ); + } + else if ((!strcmp(arg, "-name")) && (i < argc)) + { + mUpdater.mProductName = NSToString( [args objectAtIndex:(++i)] ); + } + else if ((!strcmp(arg, "-bundleid")) && (i < argc)) + { + mUpdater.mBundleID = NSToString( [args objectAtIndex:(++i)] ); + } + else if ((!strcmp(arg, "-dmg")) && (i < argc)) + { + mUpdater.mDmgFile = NSToString( [args objectAtIndex:(++i)] ); + } + else if ((!strcmp(arg, "-marker")) && (i < argc)) + { + mUpdater.mMarkerPath = NSToString( [args objectAtIndex:(++i)] ); + } + } + return 0; +} + +bool isDirWritable(const std::string& dir_name) +{ + + NSString *fullPath = [NSString stringWithCString:dir_name.c_str() + encoding:[NSString defaultCStringEncoding]]; + + NSFileManager *fm = [NSFileManager defaultManager]; + bool result = [fm isWritableFileAtPath:fullPath]; + + return result; +} + +std::string* getUserTrashFolder() +{ + NSString *trash_str=[NSHomeDirectory() stringByAppendingPathComponent:@".Trash"]; + return NSToString( trash_str ); + +} + +bool isFSRefViewerBundle(const std::string& targetURL) +{ + bool result = false; + + NSString *fullPath = [NSString stringWithCString:targetURL.c_str() + encoding:[NSString defaultCStringEncoding]]; + NSBundle *targetBundle = [NSBundle bundleWithPath:fullPath]; + NSString *targetBundleStr = [targetBundle bundleIdentifier]; + NSString *sourceBundleStr = [NSString stringWithCString:mUpdater.mBundleID->c_str() + encoding:[NSString defaultCStringEncoding]]; + + result = [targetBundleStr isEqualToString:sourceBundleStr]; + + if(!result) + { + std::cout << "Target bundle ID mismatch." << std::endl; + } + + return result; +} + + +- (IBAction)cancel:(id)sender +{ + gCancelled = true; + sendDone(); +} + +- (void)stopAlert +{ + NSAlert *alert = [[NSAlert alloc] init]; + [alert setAlertStyle:NSInformationalAlertStyle]; + [alert setMessageText:@"Error"]; + [alert setInformativeText:@"An error occurred while updating Second Life. Please download the latest version from www.secondlife.com."]; + + [alert beginSheetModalForWindow:_window + modalDelegate:self + + didEndSelector:@selector(stopAlertDidEnd:returnCode: + contextInfo:) + contextInfo:nil]; + } + + - (void)stopAlertDidEnd:(NSAlert *)alert + returnCode:(int)returnCode contextInfo:(void *)contextInfo +{ + [alert release]; +} + + +@end diff --git a/indra/mac_updater/mac_updater.cpp b/indra/mac_updater/mac_updater.cpp index aa45c5d23f..379e69e033 100644 --- a/indra/mac_updater/mac_updater.cpp +++ b/indra/mac_updater/mac_updater.cpp @@ -27,6 +27,8 @@ #include "linden_common.h" #include +#include +#include #include #include @@ -34,7 +36,6 @@ #include #include -#include #include "llerror.h" #include "lltimer.h" @@ -43,1177 +44,550 @@ #include "llstring.h" -#include - #include "llerrorcontrol.h" - -enum -{ - kEventClassCustom = 'Cust', - kEventCustomProgress = 'Prog', - kEventParamCustomCurValue = 'Cur ', - kEventParamCustomMaxValue = 'Max ', - kEventParamCustomText = 'Text', - kEventCustomDone = 'Done', -}; - -WindowRef gWindow = NULL; -EventHandlerRef gEventHandler = NULL; -OSStatus gFailure = noErr; -Boolean gCancelled = false; - -const char *gUpdateURL; -const char *gProductName; -const char *gBundleID; -const char *gDmgFile; -const char *gMarkerPath; - -void *updatethreadproc(void*); +#include "mac_updater.h" +#include pthread_t updatethread; -OSStatus setProgress(int cur, int max) -{ - OSStatus err; - ControlRef progressBar = NULL; - ControlID id; - - id.signature = 'prog'; - id.id = 0; - - err = GetControlByID(gWindow, &id, &progressBar); - if(err == noErr) - { - Boolean indeterminate; - - if(max == 0) - { - indeterminate = true; - err = SetControlData(progressBar, kControlEntireControl, kControlProgressBarIndeterminateTag, sizeof(Boolean), (Ptr)&indeterminate); - } - else - { - double percentage = (double)cur / (double)max; - SetControlMinimum(progressBar, 0); - SetControlMaximum(progressBar, 100); - SetControlValue(progressBar, (SInt16)(percentage * 100)); - - indeterminate = false; - err = SetControlData(progressBar, kControlEntireControl, kControlProgressBarIndeterminateTag, sizeof(Boolean), (Ptr)&indeterminate); - - Draw1Control(progressBar); - } - } - - return(err); -} - -OSStatus setProgressText(CFStringRef text) -{ - OSStatus err; - ControlRef progressText = NULL; - ControlID id; - - id.signature = 'what'; - id.id = 0; - - err = GetControlByID(gWindow, &id, &progressText); - if(err == noErr) - { - err = SetControlData(progressText, kControlEntireControl, kControlStaticTextCFStringTag, sizeof(CFStringRef), (Ptr)&text); - Draw1Control(progressText); - } - - return(err); -} - -OSStatus sendProgress(long cur, long max, CFStringRef text = NULL) -{ - OSStatus result; - EventRef evt; - - result = CreateEvent( - NULL, - kEventClassCustom, - kEventCustomProgress, - 0, - kEventAttributeNone, - &evt); - - // This event needs to be targeted at the window so it goes to the window's handler. - if(result == noErr) - { - EventTargetRef target = GetWindowEventTarget(gWindow); - result = SetEventParameter ( - evt, - kEventParamPostTarget, - typeEventTargetRef, - sizeof(target), - &target); - } - - if(result == noErr) - { - result = SetEventParameter ( - evt, - kEventParamCustomCurValue, - typeLongInteger, - sizeof(cur), - &cur); - } - - if(result == noErr) - { - result = SetEventParameter ( - evt, - kEventParamCustomMaxValue, - typeLongInteger, - sizeof(max), - &max); - } - - if(result == noErr) - { - if(text != NULL) - { - result = SetEventParameter ( - evt, - kEventParamCustomText, - typeCFStringRef, - sizeof(text), - &text); - } - } - - if(result == noErr) - { - // Send the event - PostEventToQueue( - GetMainEventQueue(), - evt, - kEventPriorityStandard); - - } - - return(result); -} - -OSStatus sendDone(void) -{ - OSStatus result; - EventRef evt; - - result = CreateEvent( - NULL, - kEventClassCustom, - kEventCustomDone, - 0, - kEventAttributeNone, - &evt); - - // This event needs to be targeted at the window so it goes to the window's handler. - if(result == noErr) - { - EventTargetRef target = GetWindowEventTarget(gWindow); - result = SetEventParameter ( - evt, - kEventParamPostTarget, - typeEventTargetRef, - sizeof(target), - &target); - } - - if(result == noErr) - { - // Send the event - PostEventToQueue( - GetMainEventQueue(), - evt, - kEventPriorityStandard); - - } - - return(result); -} - -OSStatus dialogHandler(EventHandlerCallRef handler, EventRef event, void *userdata) -{ - OSStatus result = eventNotHandledErr; - OSStatus err; - UInt32 evtClass = GetEventClass(event); - UInt32 evtKind = GetEventKind(event); - - if((evtClass == kEventClassCommand) && (evtKind == kEventCommandProcess)) - { - HICommand cmd; - err = GetEventParameter(event, kEventParamDirectObject, typeHICommand, NULL, sizeof(cmd), NULL, &cmd); - - if(err == noErr) - { - switch(cmd.commandID) - { - case kHICommandCancel: - gCancelled = true; -// QuitAppModalLoopForWindow(gWindow); - result = noErr; - break; - } - } - } - else if((evtClass == kEventClassCustom) && (evtKind == kEventCustomProgress)) - { - // Request to update the progress dialog - long cur = 0; - long max = 0; - CFStringRef text = NULL; - (void) GetEventParameter(event, kEventParamCustomCurValue, typeLongInteger, NULL, sizeof(cur), NULL, &cur); - (void) GetEventParameter(event, kEventParamCustomMaxValue, typeLongInteger, NULL, sizeof(max), NULL, &max); - (void) GetEventParameter(event, kEventParamCustomText, typeCFStringRef, NULL, sizeof(text), NULL, &text); - - err = setProgress(cur, max); - if(err == noErr) - { - if(text != NULL) - { - setProgressText(text); - } - } - - result = noErr; - } - else if((evtClass == kEventClassCustom) && (evtKind == kEventCustomDone)) - { - // We're done. Exit the modal loop. - QuitAppModalLoopForWindow(gWindow); - result = noErr; - } - - return(result); -} - -#if 0 -size_t curl_download_callback(void *data, size_t size, size_t nmemb, - void *user_data) -{ - S32 bytes = size * nmemb; - char *cdata = (char *) data; - for (int i =0; i < bytes; i += 1) - { - gServerResponse.append(cdata[i]); - } - return bytes; -} -#endif - -int curl_progress_callback_func(void *clientp, - double dltotal, - double dlnow, - double ultotal, - double ulnow) -{ - int max = (int)(dltotal / 1024.0); - int cur = (int)(dlnow / 1024.0); - sendProgress(cur, max); - - if(gCancelled) - return(1); - - return(0); -} +LLMacUpdater* LLMacUpdater::sInstance = NULL; -int parse_args(int argc, char **argv) +LLMacUpdater::LLMacUpdater(): + mUpdateURL (NULL), + mProductName (NULL), + mBundleID (NULL), + mDmgFile (NULL), + mMarkerPath (NULL) { - int j; - - for (j = 1; j < argc; j++) - { - if ((!strcmp(argv[j], "-url")) && (++j < argc)) - { - gUpdateURL = argv[j]; - } - else if ((!strcmp(argv[j], "-name")) && (++j < argc)) - { - gProductName = argv[j]; - } - else if ((!strcmp(argv[j], "-bundleid")) && (++j < argc)) - { - gBundleID = argv[j]; - } - else if ((!strcmp(argv[j], "-dmg")) && (++j < argc)) - { - gDmgFile = argv[j]; - } - else if ((!strcmp(argv[j], "-marker")) && (++j < argc)) - { - gMarkerPath = argv[j];; - } - } - - return 0; + sInstance = this; } -int main(int argc, char **argv) +void LLMacUpdater::doUpdate() { - // We assume that all the logs we're looking for reside on the current drive + // We assume that all the logs we're looking for reside on the current drive gDirUtilp->initAppDirs("SecondLife"); - + LLError::initForApplication( gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "")); - + // Rename current log file to ".old" std::string old_log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "updater.log.old"); std::string log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "updater.log"); LLFile::rename(log_file.c_str(), old_log_file.c_str()); - + // Set the log file to updater.log LLError::logToFile(log_file); - - ///////////////////////////////////////// - // - // Process command line arguments - // - gUpdateURL = NULL; - gProductName = NULL; - gBundleID = NULL; - gDmgFile = NULL; - gMarkerPath = NULL; - parse_args(argc, argv); - if ((gUpdateURL == NULL) && (gDmgFile == NULL)) + + if ((mUpdateURL == NULL) && (mDmgFile == NULL)) { llinfos << "Usage: mac_updater -url | -dmg [-name ] [-program ]" << llendl; exit(1); } else { - llinfos << "Update url is: " << gUpdateURL << llendl; - if (gProductName) + llinfos << "Update url is: " << mUpdateURL << llendl; + if (mProductName) { - llinfos << "Product name is: " << gProductName << llendl; + llinfos << "Product name is: " << *mProductName << llendl; } else { - gProductName = "Second Life"; + mProductName = new std::string("Second Life"); } - if (gBundleID) + if (mBundleID) { - llinfos << "Bundle ID is: " << gBundleID << llendl; + llinfos << "Bundle ID is: " << *mBundleID << llendl; } else { - gBundleID = "com.secondlife.indra.viewer"; + mBundleID = new std::string("com.secondlife.indra.viewer"); } } - llinfos << "Starting " << gProductName << " Updater" << llendl; - - // Real UI... - OSStatus err; - IBNibRef nib = NULL; - - err = CreateNibReference(CFSTR("AutoUpdater"), &nib); - - char windowTitle[MAX_PATH]; /* Flawfinder: ignore */ - snprintf(windowTitle, sizeof(windowTitle), "%s Updater", gProductName); - CFStringRef windowTitleRef = NULL; - windowTitleRef = CFStringCreateWithCString(NULL, windowTitle, kCFStringEncodingUTF8); - - if(err == noErr) - { - err = CreateWindowFromNib(nib, CFSTR("Updater"), &gWindow); - } - - if (err == noErr) - { - err = SetWindowTitleWithCFString(gWindow, windowTitleRef); - } - CFRelease(windowTitleRef); - - if(err == noErr) - { - // Set up an event handler for the window. - EventTypeSpec handlerEvents[] = - { - { kEventClassCommand, kEventCommandProcess }, - { kEventClassCustom, kEventCustomProgress }, - { kEventClassCustom, kEventCustomDone } - }; - InstallStandardEventHandler(GetWindowEventTarget(gWindow)); - InstallWindowEventHandler( - gWindow, - NewEventHandlerUPP(dialogHandler), - GetEventTypeCount (handlerEvents), - handlerEvents, - 0, - &gEventHandler); - } - - if(err == noErr) - { - ShowWindow(gWindow); - SelectWindow(gWindow); - } - - if(err == noErr) - { - pthread_create(&updatethread, - NULL, - &updatethreadproc, - NULL); - - } - - if(err == noErr) - { - RunAppModalLoopForWindow(gWindow); - } - + llinfos << "Starting " << *mProductName << " Updater" << llendl; + + pthread_create(&updatethread, + NULL, + &sUpdatethreadproc, + NULL); + + void *threadresult; - + pthread_join(updatethread, &threadresult); - - if(!gCancelled && (gFailure != noErr)) + + if(gCancelled || gFailure) { - // Something went wrong. Since we always just tell the user to download a new version, we don't really care what. - AlertStdCFStringAlertParamRec params; - SInt16 retval_mac = 1; - DialogRef alert = NULL; - OSStatus err; - - params.version = kStdCFStringAlertVersionOne; - params.movable = false; - params.helpButton = false; - params.defaultText = (CFStringRef)kAlertDefaultOKText; - params.cancelText = 0; - params.otherText = 0; - params.defaultButton = 1; - params.cancelButton = 0; - params.position = kWindowDefaultPosition; - params.flags = 0; - - err = CreateStandardAlert( - kAlertStopAlert, - CFSTR("Error"), - CFSTR("An error occurred while updating Second Life. Please download the latest version from www.secondlife.com."), - ¶ms, - &alert); - - if(err == noErr) - { - err = RunStandardAlert( - alert, - NULL, - &retval_mac); - } - - if(gMarkerPath != 0) + sendStopAlert(); + + if(mMarkerPath != 0) { // Create a install fail marker that can be used by the viewer to // detect install problems. - std::ofstream stream(gMarkerPath); + std::ofstream stream(mMarkerPath->c_str()); if(stream) stream << -1; } exit(-1); } else { exit(0); } - - if(gWindow != NULL) - { - DisposeWindow(gWindow); - } - - if(nib != NULL) - { - DisposeNibReference(nib); - } - return 0; + return; } -bool isDirWritable(FSRef &dir) +//SPATTERS TODO this should be moved to lldir_mac.cpp +const std::string LLMacUpdater::walkParents( unsigned int depth, const std::string& childpath ) { - bool result = false; - - // Test for a writable directory by creating a directory, then deleting it again. - // This is kinda lame, but will pretty much always give the right answer. - - OSStatus err = noErr; - char temp[PATH_MAX] = ""; /* Flawfinder: ignore */ + boost::filesystem::path fullpath(childpath.c_str()); + + while (depth >= 0 && fullpath.has_parent_path()) + { + fullpath = boost::filesystem::path(fullpath.parent_path()); + --depth; + } + + return fullpath.string(); +} - err = FSRefMakePath(&dir, (UInt8*)temp, sizeof(temp)); +//#if 0 +//size_t curl_download_callback(void *data, size_t size, size_t nmemb, +// void *user_data) +//{ +// S32 bytes = size * nmemb; +// char *cdata = (char *) data; +// for (int i =0; i < bytes; i += 1) +// { +// gServerResponse.append(cdata[i]); +// } +// return bytes; +//} +//#endif - if(err == noErr) - { - strncat(temp, "/.test_XXXXXX", (sizeof(temp) - strlen(temp)) - 1); - - if(mkdtemp(temp) != NULL) - { - // We were able to make the directory. This means the directory is writable. - result = true; - - // Clean up. - rmdir(temp); - } - } - -#if 0 - // This seemed like a good idea, but won't tell us if we're on a volume mounted read-only. - UInt8 perm; - err = FSGetUserPrivilegesPermissions(&targetParentRef, &perm, NULL); - if(err == noErr) - { - if(perm & kioACUserNoMakeChangesMask) - { - // Parent directory isn't writable. - llinfos << "Target parent directory not writable." << llendl; - err = -1; - replacingTarget = false; - } - } -#endif +int curl_progress_callback_func(void *clientp, + double dltotal, + double dlnow, + double ultotal, + double ulnow) +{ + int max = (int)(dltotal / 1024.0); + int cur = (int)(dlnow / 1024.0); + setProgress(cur, max); + + if(gCancelled) + return(1); - return result; + return(0); } -static std::string HFSUniStr255_to_utf8str(const HFSUniStr255* src) +bool LLMacUpdater::isApplication(const std::string& app_str) { - llutf16string string16((U16*)&(src->unicode), src->length); - std::string result = utf16str_to_utf8str(string16); - return result; + return !(bool) app_str.compare( app_str.length()-4, 4, ".app"); } - -int restoreObject(const char* aside, const char* target, const char* path, const char* object) + +// Search through the directory specified by 'parent' for an item that appears to be a Second Life viewer. +bool LLMacUpdater::findAppBundleOnDiskImage(const boost::filesystem::path& dir_path, + boost::filesystem::path& path_found) { - char source[PATH_MAX] = ""; /* Flawfinder: ignore */ - char dest[PATH_MAX] = ""; /* Flawfinder: ignore */ - snprintf(source, sizeof(source), "%s/%s/%s", aside, path, object); - snprintf(dest, sizeof(dest), "%s/%s", target, path); - FSRef sourceRef; - FSRef destRef; - OSStatus err; - err = FSPathMakeRef((UInt8 *)source, &sourceRef, NULL); - if(err != noErr) return false; - err = FSPathMakeRef((UInt8 *)dest, &destRef, NULL); - if(err != noErr) return false; - - llinfos << "Copying " << source << " to " << dest << llendl; - - err = FSCopyObjectSync( - &sourceRef, - &destRef, - NULL, - NULL, - kFSFileOperationOverwrite); - - if(err != noErr) return false; - return true; + if ( !exists( dir_path ) ) return false; + + boost::filesystem::directory_iterator end_itr; + + for ( boost::filesystem::directory_iterator itr( dir_path ); + itr != end_itr; + ++itr ) + { + if ( boost::filesystem::is_directory(itr->status()) ) + { + std::string dir_name = itr->string(); + if ( isApplication(dir_name) ) + { + if(isFSRefViewerBundle(dir_name)) + { + llinfos << dir_name << " is the one" << llendl; + + path_found = itr->path(); + return true; + } + } + } + } + return false; } -// Replace any mention of "Second Life" with the product name. -void filterFile(const char* filename) +bool LLMacUpdater::verifyDirectory(const boost::filesystem::path* directory, bool isParent) { - char temp[PATH_MAX] = ""; /* Flawfinder: ignore */ - // First copy the target's version, so we can run it through sed. - snprintf(temp, sizeof(temp), "cp '%s' '%s.tmp'", filename, filename); - system(temp); /* Flawfinder: ignore */ - - // Now run it through sed. - snprintf(temp, sizeof(temp), - "sed 's/Second Life/%s/g' '%s.tmp' > '%s'", gProductName, filename, filename); - system(temp); /* Flawfinder: ignore */ + bool replacingTarget; + std::string app_str = directory->string(); + + if (boost::filesystem::is_directory(*directory)) + { + // This is fine, just means we're not replacing anything. + replacingTarget = true; + } + else + { + replacingTarget = isParent; + } + + //Check that the directory is writeable. + if(!isDirWritable(app_str)) + { + // Parent directory isn't writable. + llinfos << "Target directory not writable." << llendl; + replacingTarget = false; + } + return replacingTarget; } - -static bool isFSRefViewerBundle(FSRef *targetRef) + +bool LLMacUpdater::getViewerDir(boost::filesystem::path &app_dir) { - bool result = false; - CFURLRef targetURL = NULL; - CFBundleRef targetBundle = NULL; - CFStringRef targetBundleID = NULL; - CFStringRef sourceBundleID = NULL; - - targetURL = CFURLCreateFromFSRef(NULL, targetRef); - - if(targetURL == NULL) - { - llinfos << "Error creating target URL." << llendl; - } - else - { - targetBundle = CFBundleCreate(NULL, targetURL); - } - - if(targetBundle == NULL) - { - llinfos << "Failed to create target bundle." << llendl; - } - else - { - targetBundleID = CFBundleGetIdentifier(targetBundle); - } - - if(targetBundleID == NULL) - { - llinfos << "Couldn't retrieve target bundle ID." << llendl; - } - else - { - sourceBundleID = CFStringCreateWithCString(NULL, gBundleID, kCFStringEncodingUTF8); - if(CFStringCompare(sourceBundleID, targetBundleID, 0) == kCFCompareEqualTo) - { - // This is the bundle we're looking for. - result = true; - } - else - { - llinfos << "Target bundle ID mismatch." << llendl; - } - } - - // Don't release targetBundleID -- since we don't retain it, it's released when targetBundle is released. - if(targetURL != NULL) - CFRelease(targetURL); - if(targetBundle != NULL) - CFRelease(targetBundle); - - return result; + std::string app_dir_str; + + //Walk up 6 levels from the App Updater's installation point. + app_dir_str = walkParents( 6, *mApplicationPath ); + + app_dir = boost::filesystem::path(app_dir_str); + + std::string app_str(app_dir.string()); + + //Check to see that the directory's name ends in .app Lame but it's the best thing we have to go on. + //If it's not there, we're going to default to /Applications/VIEWERNAME + if (!isApplication(app_str)) + { + llinfos << "Target search failed, defaulting to /Applications/" << *mProductName << ".app." << llendl; + std::string newpath = std::string("/Applications/") + mProductName->c_str(); + app_dir = boost::filesystem::path(newpath); + } + return verifyDirectory(&app_dir); } -// Search through the directory specified by 'parent' for an item that appears to be a Second Life viewer. -static OSErr findAppBundleOnDiskImage(FSRef *parent, FSRef *app) +bool LLMacUpdater::downloadDMG(const std::string& dmgName, boost::filesystem::path* temp_dir) { - FSIterator iterator; - bool found = false; + LLFILE *downloadFile = NULL; + char temp[PATH_MAX] = ""; /* Flawfinder: ignore */ - OSErr err = FSOpenIterator( parent, kFSIterateFlat, &iterator ); - if(!err) + chdir(temp_dir->string().c_str()); + + snprintf(temp, sizeof(temp), "SecondLife.dmg"); + + downloadFile = LLFile::fopen(temp, "wb"); /* Flawfinder: ignore */ + if(downloadFile == NULL) + { + return false; + } + + bool success = false; + + CURL *curl = curl_easy_init(); + + curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1); + // curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &curl_download_callback); + curl_easy_setopt(curl, CURLOPT_FILE, downloadFile); + curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0); + curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, &curl_progress_callback_func); + curl_easy_setopt(curl, CURLOPT_URL, mUpdateURL); + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); + + sendProgress(0, 1, std::string("Downloading...")); + + CURLcode result = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + + if(gCancelled) + { + llinfos << "User cancel, bailing out."<< llendl; + goto close_file; + } + + if(result != CURLE_OK) + { + llinfos << "Error " << result << " while downloading disk image."<< llendl; + goto close_file; + } + + fclose(downloadFile); + downloadFile = NULL; + + success = true; + +close_file: + // Close disk image file if necessary + if(downloadFile != NULL) { - do - { - ItemCount actualObjects = 0; - Boolean containerChanged = false; - FSCatalogInfo info; - FSRef ref; - HFSUniStr255 unicodeName; - err = FSGetCatalogInfoBulk( - iterator, - 1, - &actualObjects, - &containerChanged, - kFSCatInfoNodeFlags, - &info, - &ref, - NULL, - &unicodeName ); - - if(actualObjects == 0) - break; - - if(!err) - { - // Call succeeded and not done with the iteration. - std::string name = HFSUniStr255_to_utf8str(&unicodeName); + llinfos << "Closing download file." << llendl; + + fclose(downloadFile); + downloadFile = NULL; + } - llinfos << "Considering \"" << name << "\"" << llendl; + return success; +} + +bool LLMacUpdater::doMount(const std::string& dmgName, char* deviceNode, const boost::filesystem::path& temp_dir) +{ + char temp[PATH_MAX] = ""; /* Flawfinder: ignore */ + + sendProgress(0, 0, std::string("Mounting image...")); + chdir(temp_dir.string().c_str()); + std::string mnt_dir = temp_dir.string() + std::string("/mnt"); + LLFile::mkdir(mnt_dir.c_str(), 0700); + + // NOTE: we could add -private at the end of this command line to keep the image from showing up in the Finder, + // but if our cleanup fails, this makes it much harder for the user to unmount the image. + std::string mountOutput; + boost::format cmdFormat("hdiutil attach %s -mountpoint mnt"); + cmdFormat % dmgName; + FILE* mounter = popen(cmdFormat.str().c_str(), "r"); /* Flawfinder: ignore */ + + if(mounter == NULL) + { + llinfos << "Failed to mount disk image, exiting."<< llendl; + return false; + } + + // We need to scan the output from hdiutil to find the device node it uses to attach the disk image. + // If we don't have this information, we can't detach it later. + while(mounter != NULL) + { + size_t len = fread(temp, 1, sizeof(temp)-1, mounter); + temp[len] = 0; + mountOutput.append(temp); + if(len < sizeof(temp)-1) + { + // End of file or error. + int result = pclose(mounter); + if(result != 0) + { + // NOTE: We used to abort here, but pclose() started returning + // -1, possibly when the size of the DMG passed a certain point + llinfos << "Unexpected result closing pipe: " << result << llendl; + } + mounter = NULL; + } + } + + if(!mountOutput.empty()) + { + const char *s = mountOutput.c_str(); + const char *prefix = "/dev/"; + char *sub = strstr(s, prefix); + + if(sub != NULL) + { + sub += strlen(prefix); /* Flawfinder: ignore */ + sscanf(sub, "%1023s", deviceNode); /* Flawfinder: ignore */ + } + } + + if(deviceNode[0] != 0) + { + llinfos << "Disk image attached on /dev/" << deviceNode << llendl; + } + else + { + llinfos << "Disk image device node not found!" << llendl; + return false; + } + + return true; +} - if(info.nodeFlags & kFSNodeIsDirectoryMask) - { - // This is a directory. See if it's a .app - if(name.find(".app") != std::string::npos) - { - // Looks promising. Check to see if it has the right bundle identifier. - if(isFSRefViewerBundle(&ref)) - { - llinfos << name << " is the one" << llendl; - // This is the one. Return it. - *app = ref; - found = true; - break; - } else { - llinfos << name << " is not the bundle we are looking for; move along" << llendl; - } +bool LLMacUpdater::moveApplication (const boost::filesystem::path& app_dir, + const boost::filesystem::path& temp_dir, + boost::filesystem::path& aside_dir) +{ + try + { + //Grab filename from installdir append to tempdir move set aside_dir to moved path. + std::string install_str = app_dir.parent_path().string(); + std::string temp_str = temp_dir.string(); + std::string app_str = app_dir.filename(); + aside_dir = boost::filesystem::path( boost::filesystem::operator/(temp_dir,app_str) ); + std::cout << "Attempting to move " << app_dir.string() << " to " << aside_dir.string() << std::endl; + + boost::filesystem::rename(app_dir, aside_dir); + } + catch(boost::filesystem::filesystem_error e) + { + llinfos << "Application move failed." << llendl; + return false; + } + return true; +} - } - } - } - } - while(!err); - - llinfos << "closing the iterator" << llendl; - - FSCloseIterator(iterator); - - llinfos << "closed" << llendl; - } - - if(!err && !found) - err = fnfErr; - - return err; +bool LLMacUpdater::doInstall(const boost::filesystem::path& app_dir, + const boost::filesystem::path& temp_dir, + boost::filesystem::path& mount_dir, + bool replacingTarget) +{ + std::string temp_name = temp_dir.string() + std::string("/mnt"); + + llinfos << "Disk image mount point is: " << temp_name << llendl; + + mount_dir = boost::filesystem::path(temp_name.c_str()); + + if (! boost::filesystem::exists ( mount_dir ) ) + { + llinfos << "Couldn't make FSRef to disk image mount point." << llendl; + return false; + } + + sendProgress(0, 0, std::string("Searching for the app bundle...")); + + boost::filesystem::path source_dir; + + if ( !findAppBundleOnDiskImage(mount_dir, source_dir) ) + { + llinfos << "Couldn't find application bundle on mounted disk image." << llendl; + return false; + } + else + { + llinfos << "found the bundle." << llendl; + } + + sendProgress(0, 0, std::string("Preparing to copy files...")); + + // this will hold the name of the destination target + boost::filesystem::path aside_dir; + + if(replacingTarget) + { + + if (! moveApplication (app_dir, temp_dir, aside_dir) ) + { + llwarns << "failed to move aside old version." << llendl; + return false; + } + } + + sendProgress(0, 0, std::string("Copying files...")); + + llinfos << "Starting copy..." << llendl; + // If we were replacingTarget, we've moved the app to a temp directory. + // Otherwise the destination should be empty. + // We have mounted the DMG as a volume so we should be able to just + // move the app from the volume to the destination and everything will just work. + + + // Copy the new version from the disk image to the target location. + + //The installer volume is mounted read-only so we can't move. Instead copy and then unmount. + if (! copyDir(source_dir.string(), app_dir.string()) ) + { + llwarns << "Failed to copy " << source_dir.string() << " to " << app_dir.string() << llendl; + + // Something went wrong during the copy. Attempt to put the old version back and bail. + boost::filesystem::rename(app_dir, aside_dir); + return false; + + } + + // The update has succeeded. Clear the cache directory. + + sendProgress(0, 0, std::string("Clearing cache...")); + + llinfos << "Clearing cache..." << llendl; + + gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""), "*.*"); + + llinfos << "Clear complete." << llendl; + + return true; } -void *updatethreadproc(void*) +void* LLMacUpdater::updatethreadproc(void*) { char tempDir[PATH_MAX] = ""; /* Flawfinder: ignore */ - FSRef tempDirRef; char temp[PATH_MAX] = ""; /* Flawfinder: ignore */ // *NOTE: This buffer length is used in a scanf() below. char deviceNode[1024] = ""; /* Flawfinder: ignore */ - LLFILE *downloadFile = NULL; - OSStatus err; - ProcessSerialNumber psn; - char target[PATH_MAX] = ""; /* Flawfinder: ignore */ - FSRef targetRef; - FSRef targetParentRef; - FSVolumeRefNum targetVol; - FSRef trashFolderRef; - Boolean replacingTarget = false; - - memset(&tempDirRef, 0, sizeof(tempDirRef)); - memset(&targetRef, 0, sizeof(targetRef)); - memset(&targetParentRef, 0, sizeof(targetParentRef)); - - try - { - // Attempt to get a reference to the Second Life application bundle containing this updater. - // Any failures during this process will cause us to default to updating /Applications/Second Life.app - { - FSRef myBundle; - - err = GetCurrentProcess(&psn); - if(err == noErr) - { - err = GetProcessBundleLocation(&psn, &myBundle); - } - - if(err == noErr) - { - // Sanity check: Make sure the name of the item referenced by targetRef is "Second Life.app". - FSRefMakePath(&myBundle, (UInt8*)target, sizeof(target)); - - llinfos << "Updater bundle location: " << target << llendl; - } - - // Our bundle should be in Second Life.app/Contents/Resources/AutoUpdater.app - // so we need to go up 3 levels to get the path to the main application bundle. - if(err == noErr) - { - err = FSGetCatalogInfo(&myBundle, kFSCatInfoNone, NULL, NULL, NULL, &targetRef); - } - if(err == noErr) - { - err = FSGetCatalogInfo(&targetRef, kFSCatInfoNone, NULL, NULL, NULL, &targetRef); - } - if(err == noErr) - { - err = FSGetCatalogInfo(&targetRef, kFSCatInfoNone, NULL, NULL, NULL, &targetRef); - } - - // And once more to get the parent of the target - if(err == noErr) - { - err = FSGetCatalogInfo(&targetRef, kFSCatInfoNone, NULL, NULL, NULL, &targetParentRef); - } - - if(err == noErr) - { - FSRefMakePath(&targetRef, (UInt8*)target, sizeof(target)); - llinfos << "Path to target: " << target << llendl; - } - - // Sanity check: make sure the target is a bundle with the right identifier - if(err == noErr) - { - // Assume the worst... - err = -1; - - if(isFSRefViewerBundle(&targetRef)) - { - // This is the bundle we're looking for. - err = noErr; - replacingTarget = true; - } - } - - // Make sure the target's parent directory is writable. - if(err == noErr) - { - if(!isDirWritable(targetParentRef)) - { - // Parent directory isn't writable. - llinfos << "Target parent directory not writable." << llendl; - err = -1; - replacingTarget = false; - } - } - - if(err != noErr) - { - Boolean isDirectory; - llinfos << "Target search failed, defaulting to /Applications/" << gProductName << ".app." << llendl; - - // Set up the parent directory - err = FSPathMakeRef((UInt8*)"/Applications", &targetParentRef, &isDirectory); - if((err != noErr) || (!isDirectory)) - { - // We're so hosed. - llinfos << "Applications directory not found, giving up." << llendl; - throw 0; - } - - snprintf(target, sizeof(target), "/Applications/%s.app", gProductName); - - memset(&targetRef, 0, sizeof(targetRef)); - err = FSPathMakeRef((UInt8*)target, &targetRef, NULL); - if(err == fnfErr) - { - // This is fine, just means we're not replacing anything. - err = noErr; - replacingTarget = false; - } - else - { - replacingTarget = true; - } - - // Make sure the target's parent directory is writable. - if(err == noErr) - { - if(!isDirWritable(targetParentRef)) - { - // Parent directory isn't writable. - llinfos << "Target parent directory not writable." << llendl; - err = -1; - replacingTarget = false; - } - } - - } - - // If we haven't fixed all problems by this point, just bail. - if(err != noErr) - { - llinfos << "Unable to pick a target, giving up." << llendl; - throw 0; - } - } - - // Find the volID of the volume the target resides on - { - FSCatalogInfo info; - err = FSGetCatalogInfo( - &targetParentRef, - kFSCatInfoVolume, - &info, - NULL, - NULL, - NULL); - - if(err != noErr) - throw 0; - - targetVol = info.volume; - } - - // Find the temporary items and trash folders on that volume. - err = FSFindFolder( - targetVol, - kTrashFolderType, - true, - &trashFolderRef); - - if(err != noErr) - throw 0; - -#if 0 // *HACK for DEV-11935 see below for details. - - FSRef tempFolderRef; - - err = FSFindFolder( - targetVol, - kTemporaryFolderType, - true, - &tempFolderRef); - - if(err != noErr) - throw 0; - - err = FSRefMakePath(&tempFolderRef, (UInt8*)temp, sizeof(temp)); + + bool replacingTarget = false; - if(err != noErr) - throw 0; + boost::filesystem::path install_dir; + boost::filesystem::path app_dir; + boost::filesystem::path temp_dir; + boost::filesystem::path mount_dir; + + // Attempt to get a reference to the Second Life application bundle containing this updater. + // Any failures during this process will cause us to default to updating /Applications/Second Life.app -#else - - // *HACK for DEV-11935 the above kTemporaryFolderType query was giving - // back results with path names that seem to be too long to be used as - // mount points. I suspect this incompatibility was introduced in the - // Leopard 10.5.2 update, but I have not verified this. - char const HARDCODED_TMP[] = "/tmp"; - strncpy(temp, HARDCODED_TMP, sizeof(HARDCODED_TMP)); + try + { + replacingTarget = getViewerDir( app_dir ); + install_dir = app_dir.parent_path(); + + if (!mkTempDir(temp_dir)) + { + throw 0; + } + + //In case the dir doesn't exist, try to create it. If create fails, verify it exists. + if (! boost::filesystem::create_directory(install_dir)) + { + + + if(isFSRefViewerBundle(install_dir.parent_path().string())) + { + // This is the bundle we're looking for. + replacingTarget = true; + } + } + + if ( !verifyDirectory(&install_dir, true) ) + { + // We're so hosed. + llinfos << "Applications directory not found, giving up." << llendl; + throw 0; + } -#endif // 0 *HACK for DEV-11935 // Skip downloading the file if the dmg was passed on the command line. std::string dmgName; - if(gDmgFile != NULL) { - dmgName = basename((char *)gDmgFile); - char * dmgDir = dirname((char *)gDmgFile); - strncpy(tempDir, dmgDir, sizeof(tempDir)); - err = FSPathMakeRef((UInt8*)tempDir, &tempDirRef, NULL); - if(err != noErr) throw 0; - chdir(tempDir); - goto begin_install; + if(mDmgFile != NULL) { + //Create a string from the mDmgFile then a dir reference to that. + //change to that directory and begin install. + + boost::filesystem::path dmg_path(*mDmgFile); + + dmgName = dmg_path.string(); + std::string* dmgPath = new std::string(dmg_path.parent_path().string()); + if (!isDirWritable(*dmgPath)) throw 0; + + chdir(dmgPath->c_str()); } else { // Continue on to download file. dmgName = "SecondLife.dmg"; - } - - - strncat(temp, "/SecondLifeUpdate_XXXXXX", (sizeof(temp) - strlen(temp)) - 1); - if(mkdtemp(temp) == NULL) - { - throw 0; - } - - strncpy(tempDir, temp, sizeof(tempDir)); - temp[sizeof(tempDir) - 1] = '\0'; - - llinfos << "tempDir is " << tempDir << llendl; - - err = FSPathMakeRef((UInt8*)tempDir, &tempDirRef, NULL); - - if(err != noErr) - throw 0; - - chdir(tempDir); - - snprintf(temp, sizeof(temp), "SecondLife.dmg"); - - downloadFile = LLFile::fopen(temp, "wb"); /* Flawfinder: ignore */ - if(downloadFile == NULL) - { - throw 0; - } - - { - CURL *curl = curl_easy_init(); - - curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1); - // curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &curl_download_callback); - curl_easy_setopt(curl, CURLOPT_FILE, downloadFile); - curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0); - curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, &curl_progress_callback_func); - curl_easy_setopt(curl, CURLOPT_URL, gUpdateURL); - curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); - - sendProgress(0, 1, CFSTR("Downloading...")); - - CURLcode result = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - - if(gCancelled) - { - llinfos << "User cancel, bailing out."<< llendl; - throw 0; - } - - if(result != CURLE_OK) - { - llinfos << "Error " << result << " while downloading disk image."<< llendl; - throw 0; - } - - fclose(downloadFile); - downloadFile = NULL; - } - - begin_install: - sendProgress(0, 0, CFSTR("Mounting image...")); - LLFile::mkdir("mnt", 0700); - - // NOTE: we could add -private at the end of this command line to keep the image from showing up in the Finder, - // but if our cleanup fails, this makes it much harder for the user to unmount the image. - std::string mountOutput; - boost::format cmdFormat("hdiutil attach %s -mountpoint mnt"); - cmdFormat % dmgName; - FILE* mounter = popen(cmdFormat.str().c_str(), "r"); /* Flawfinder: ignore */ - - if(mounter == NULL) - { - llinfos << "Failed to mount disk image, exiting."<< llendl; - throw 0; - } - - // We need to scan the output from hdiutil to find the device node it uses to attach the disk image. - // If we don't have this information, we can't detach it later. - while(mounter != NULL) - { - size_t len = fread(temp, 1, sizeof(temp)-1, mounter); - temp[len] = 0; - mountOutput.append(temp); - if(len < sizeof(temp)-1) - { - // End of file or error. - int result = pclose(mounter); - if(result != 0) - { - // NOTE: We used to abort here, but pclose() started returning - // -1, possibly when the size of the DMG passed a certain point - llinfos << "Unexpected result closing pipe: " << result << llendl; - } - mounter = NULL; - } - } - - if(!mountOutput.empty()) - { - const char *s = mountOutput.c_str(); - const char *prefix = "/dev/"; - char *sub = strstr(s, prefix); - - if(sub != NULL) - { - sub += strlen(prefix); /* Flawfinder: ignore */ - sscanf(sub, "%1023s", deviceNode); /* Flawfinder: ignore */ - } - } - - if(deviceNode[0] != 0) - { - llinfos << "Disk image attached on /dev/" << deviceNode << llendl; - } - else - { - llinfos << "Disk image device node not found!" << llendl; - throw 0; - } - - // Get an FSRef to the new application on the disk image - FSRef sourceRef; - FSRef mountRef; - snprintf(temp, sizeof(temp), "%s/mnt", tempDir); - - llinfos << "Disk image mount point is: " << temp << llendl; + + + if (!downloadDMG(dmgName, &temp_dir)) + { + throw 0; + } + } + + if (!doMount(dmgName, deviceNode, temp_dir)) + { + throw 0; + } + + if (!doInstall( app_dir, temp_dir, mount_dir, replacingTarget )) + { + throw 0; + } - err = FSPathMakeRef((UInt8 *)temp, &mountRef, NULL); - if(err != noErr) - { - llinfos << "Couldn't make FSRef to disk image mount point." << llendl; - throw 0; - } - - sendProgress(0, 0, CFSTR("Searching for the app bundle...")); - err = findAppBundleOnDiskImage(&mountRef, &sourceRef); - if(err != noErr) - { - llinfos << "Couldn't find application bundle on mounted disk image." << llendl; - throw 0; - } - else - { - llinfos << "found the bundle." << llendl; - } - - sendProgress(0, 0, CFSTR("Preparing to copy files...")); - - FSRef asideRef; - char aside[MAX_PATH]; /* Flawfinder: ignore */ - - // this will hold the name of the destination target - CFStringRef appNameRef; - - if(replacingTarget) - { - // Get the name of the target we're replacing - HFSUniStr255 appNameUniStr; - err = FSGetCatalogInfo(&targetRef, 0, NULL, &appNameUniStr, NULL, NULL); - if(err != noErr) - throw 0; - appNameRef = FSCreateStringFromHFSUniStr(NULL, &appNameUniStr); - - // Move aside old version (into work directory) - err = FSMoveObject(&targetRef, &tempDirRef, &asideRef); - if(err != noErr) - { - llwarns << "failed to move aside old version (error code " << - err << ")" << llendl; - throw 0; - } - - // Grab the path for later use. - err = FSRefMakePath(&asideRef, (UInt8*)aside, sizeof(aside)); - } - else - { - // Construct the name of the target based on the product name - char appName[MAX_PATH]; /* Flawfinder: ignore */ - snprintf(appName, sizeof(appName), "%s.app", gProductName); - appNameRef = CFStringCreateWithCString(NULL, appName, kCFStringEncodingUTF8); - } - - sendProgress(0, 0, CFSTR("Copying files...")); - - llinfos << "Starting copy..." << llendl; - - // Copy the new version from the disk image to the target location. - err = FSCopyObjectSync( - &sourceRef, - &targetParentRef, - appNameRef, - &targetRef, - kFSFileOperationDefaultOptions); - - // Grab the path for later use. - err = FSRefMakePath(&targetRef, (UInt8*)target, sizeof(target)); - if(err != noErr) - throw 0; - - llinfos << "Copy complete. Target = " << target << llendl; - - if(err != noErr) - { - // Something went wrong during the copy. Attempt to put the old version back and bail. - (void)FSDeleteObject(&targetRef); - if(replacingTarget) - { - (void)FSMoveObject(&asideRef, &targetParentRef, NULL); - } - throw 0; - } - else - { - // The update has succeeded. Clear the cache directory. - - sendProgress(0, 0, CFSTR("Clearing cache...")); - - llinfos << "Clearing cache..." << llendl; - - gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""), "*.*"); - - llinfos << "Clear complete." << llendl; - - } } catch(...) { if(!gCancelled) - if(gFailure == noErr) - gFailure = -1; + gFailure = true; } // Failures from here on out are all non-fatal and not reported. - sendProgress(0, 3, CFSTR("Cleaning up...")); + sendProgress(0, 3, std::string("Cleaning up...")); - // Close disk image file if necessary - if(downloadFile != NULL) - { - llinfos << "Closing download file." << llendl; - - fclose(downloadFile); - downloadFile = NULL; - } - - sendProgress(1, 3); + setProgress(1, 3); // Unmount image if(deviceNode[0] != 0) { @@ -1223,35 +597,61 @@ void *updatethreadproc(void*) system(temp); /* Flawfinder: ignore */ } - sendProgress(2, 3); + setProgress(2, 3); + std::string *trash_str=getUserTrashFolder(); // Move work directory to the trash if(tempDir[0] != 0) { llinfos << "Moving work directory to the trash." << llendl; - - FSRef trashRef; - OSStatus err = FSMoveObjectToTrashSync(&tempDirRef, &trashRef, 0); - if(err != noErr) { - llwarns << "failed to move files to trash, (error code " << - err << ")" << llendl; - } + + try + { + boost::filesystem::path trash_dir(*trash_str); + boost::filesystem::rename(mount_dir, trash_dir); + } + catch(boost::filesystem::filesystem_error e) + { + llwarns << "Failed to move " << mount_dir.string() << " to " << *trash_str << llendl; + return (NULL); + } } - if(!gCancelled && !gFailure && (target[0] != 0)) + std::string app_name_str = app_dir.string(); + + if(!gCancelled && !gFailure && !app_name_str.empty()) { + //SPATTERS todo is there no better way to do this than system calls? llinfos << "Touching application bundle." << llendl; + + std::stringstream touch_str; - snprintf(temp, sizeof(temp), "touch '%s'", target); - system(temp); /* Flawfinder: ignore */ + touch_str << "touch '" << app_name_str << "'"; + + system(touch_str.str().c_str()); /* Flawfinder: ignore */ llinfos << "Launching updated application." << llendl; + + std::stringstream open_str; + + open_str << "open '" << app_name_str << "'"; - snprintf(temp, sizeof(temp), "open '%s'", target); - system(temp); /* Flawfinder: ignore */ + system(open_str.str().c_str()); /* Flawfinder: ignore */ } sendDone(); - return(NULL); + return (NULL); } + +//static +void* LLMacUpdater::sUpdatethreadproc(void* vptr) +{ + if (!sInstance) + { + llerrs << "LLMacUpdater not instantiated before use. Aborting." << llendl; + return (NULL); + } + return sInstance->updatethreadproc(vptr); +} + diff --git a/indra/mac_updater/mac_updater.h b/indra/mac_updater/mac_updater.h new file mode 100644 index 0000000000..756f46f996 --- /dev/null +++ b/indra/mac_updater/mac_updater.h @@ -0,0 +1,89 @@ +/** + * @file mac_updater.h + * @brief + * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include +#include +#include + +#ifndef LL_MAC_UPDATER_H +#define LL_MAC_UPDATER_H +extern bool gCancelled; +extern bool gFailure; + +void *updatethreadproc(void*); +std::string* walkParents( unsigned int depth, std::string* childpath ); +std::string* getUserTrashFolder(); + +void setProgress(int cur, int max); +void setProgressText(const std::string& str); +void sendProgress(int cur, int max, std::string str); +void sendDone(); +void sendStopAlert(); + +bool isFSRefViewerBundle(const std::string& targetURL); +bool isDirWritable(const std::string& dir_name); +bool mkTempDir(boost::filesystem::path& temp_dir); +bool copyDir(const std::string& src_dir, const std::string& dest_dir); + +int oldmain(); + +class LLMacUpdater +{ +public: + LLMacUpdater(); + void doUpdate(); + const std::string walkParents( unsigned int depth, const std::string& childpath ); + bool isApplication(const std::string& app_str); + void filterFile(const char* filename); + + bool findAppBundleOnDiskImage(const boost::filesystem::path& dir_path, + boost::filesystem::path& path_found); + + bool verifyDirectory(const boost::filesystem::path* directory, bool isParent=false); + bool getViewerDir(boost::filesystem::path &app_dir); + bool downloadDMG(const std::string& dmgName, boost::filesystem::path* temp_dir); + bool doMount(const std::string& dmgName, char* deviceNode, const boost::filesystem::path& temp_dir); + bool moveApplication (const boost::filesystem::path& app_dir, + const boost::filesystem::path& temp_dir, + boost::filesystem::path& aside_dir); + bool doInstall(const boost::filesystem::path& app_dir, + const boost::filesystem::path& temp_dir, + boost::filesystem::path& mount_dir, + bool replacingTarget); + void* updatethreadproc(void*); + static void* sUpdatethreadproc(void*); + +public: + std::string *mUpdateURL; + std::string *mProductName; + std::string *mBundleID; + std::string *mDmgFile; + std::string *mMarkerPath; + std::string *mApplicationPath; + static LLMacUpdater *sInstance; + +}; +#endif \ No newline at end of file diff --git a/indra/mac_updater/main.m b/indra/mac_updater/main.m new file mode 100644 index 0000000000..aa3776a87d --- /dev/null +++ b/indra/mac_updater/main.m @@ -0,0 +1,34 @@ +/** + * @file main.m + * @brief + * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#import + +int main(int argc, char *argv[]) +{ + int retVal = NSApplicationMain(argc, (const char **)argv); + + return retVal; +} -- cgit v1.2.3 From f52f10af269b211eea91a2d7fa984fc17ffc5b9b Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Mon, 12 Nov 2012 16:22:04 -0800 Subject: Removed old nib to make way for the new. --- .../mac_crash_logger/CrashReporter.nib/classes.nib | 8 --- indra/mac_crash_logger/CrashReporter.nib/info.nib | 18 ------ .../mac_crash_logger/CrashReporter.nib/objects.xib | 68 ---------------------- 3 files changed, 94 deletions(-) delete mode 100644 indra/mac_crash_logger/CrashReporter.nib/classes.nib delete mode 100644 indra/mac_crash_logger/CrashReporter.nib/info.nib delete mode 100644 indra/mac_crash_logger/CrashReporter.nib/objects.xib diff --git a/indra/mac_crash_logger/CrashReporter.nib/classes.nib b/indra/mac_crash_logger/CrashReporter.nib/classes.nib deleted file mode 100644 index c4b887e72b..0000000000 --- a/indra/mac_crash_logger/CrashReporter.nib/classes.nib +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IBVersion - 1 - - diff --git a/indra/mac_crash_logger/CrashReporter.nib/info.nib b/indra/mac_crash_logger/CrashReporter.nib/info.nib deleted file mode 100644 index 06805c0e4f..0000000000 --- a/indra/mac_crash_logger/CrashReporter.nib/info.nib +++ /dev/null @@ -1,18 +0,0 @@ - - - - - IBFramework Version - 629 - IBLastKnownRelativeProjectPath - ../../build-darwin-i386/SecondLife.xcodeproj - IBOldestOS - 5 - IBOpenObjects - - IBSystem Version - 9E17 - targetFramework - IBCarbonFramework - - diff --git a/indra/mac_crash_logger/CrashReporter.nib/objects.xib b/indra/mac_crash_logger/CrashReporter.nib/objects.xib deleted file mode 100644 index 32647391b6..0000000000 --- a/indra/mac_crash_logger/CrashReporter.nib/objects.xib +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - ok - Send Report - 414 273 434 378 - - - not! - 2 - Don't Send - 414 390 434 487 - - - Second Life appears to have crashed or frozen the last time it ran. This crash reporter collects information about your computer's hardware configuration, operating system, and some Second Life logs, all of which are used for debugging purposes only. In the space below, please briefly describe what you were doing or trying to do just prior to the crash. Thank you for your help! This report is NOT read by Customer Support. If you have billing or other questions, please go to: http://www.secondlife.com/support/ If you don't wish to send Linden Lab a crash report, press Don't Send. - 20 20 231 487 - - - 2 - 3 - 7 - Second Life Crash Logger - - - - - - - text - TRUE - 242 23 391 484 - - - remb - Remember This Choice - 415 20 433 186 - - - 0 0 454 507 - - 257 653 711 1160 - 0 0 768 1024 - - - - - - - - - - - - - - - - CrashReporter - - File's Owner - - - IBCarbonFramework - 194 - -- cgit v1.2.3 From 44d511669ba85a0311dc8d0901f22a1f38c0790b Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Mon, 12 Nov 2012 16:25:09 -0800 Subject: Pulled cocoa crash reporter changes from old branch. --- indra/mac_crash_logger/CMakeLists.txt | 7 +- indra/mac_crash_logger/CrashReporter.nib | Bin 0 -> 32288 bytes indra/mac_crash_logger/CrashReporter.xib | 3895 ++++++++++++++++++++ indra/mac_crash_logger/Info.plist | 8 +- indra/mac_crash_logger/llcrashloggermac.cpp | 167 +- indra/mac_crash_logger/llcrashloggermac.h | 1 - indra/mac_crash_logger/llcrashloggermacdelegate.h | 50 + indra/mac_crash_logger/llcrashloggermacdelegate.mm | 75 + indra/mac_crash_logger/mac_crash_logger.cpp | 18 +- 9 files changed, 4051 insertions(+), 170 deletions(-) create mode 100644 indra/mac_crash_logger/CrashReporter.nib create mode 100644 indra/mac_crash_logger/CrashReporter.xib create mode 100644 indra/mac_crash_logger/llcrashloggermacdelegate.h create mode 100644 indra/mac_crash_logger/llcrashloggermacdelegate.mm diff --git a/indra/mac_crash_logger/CMakeLists.txt b/indra/mac_crash_logger/CMakeLists.txt index 420e836e36..87ee344598 100644 --- a/indra/mac_crash_logger/CMakeLists.txt +++ b/indra/mac_crash_logger/CMakeLists.txt @@ -23,12 +23,14 @@ include_directories( set(mac_crash_logger_SOURCE_FILES mac_crash_logger.cpp llcrashloggermac.cpp - ) + llcrashloggermacdelegate.mm + ) set(mac_crash_logger_HEADER_FILES CMakeLists.txt llcrashloggermac.h + llcrashloggermacdelegate.h ) set_source_files_properties(${mac_crash_logger_HEADER_FILES} @@ -55,9 +57,12 @@ set_target_properties(mac-crash-logger MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist ) +find_library(COCOA_LIBRARY Cocoa) + target_link_libraries(mac-crash-logger ${LLCRASHLOGGER_LIBRARIES} ${LLVFS_LIBRARIES} + ${COCOA_LIBRARIES} ${LLXML_LIBRARIES} ${LLMESSAGE_LIBRARIES} ${LLVFS_LIBRARIES} diff --git a/indra/mac_crash_logger/CrashReporter.nib b/indra/mac_crash_logger/CrashReporter.nib new file mode 100644 index 0000000000..a30d8d205c Binary files /dev/null and b/indra/mac_crash_logger/CrashReporter.nib differ diff --git a/indra/mac_crash_logger/CrashReporter.xib b/indra/mac_crash_logger/CrashReporter.xib new file mode 100644 index 0000000000..f6d4776d51 --- /dev/null +++ b/indra/mac_crash_logger/CrashReporter.xib @@ -0,0 +1,3895 @@ + + + + 1070 + 11G63 + 2182 + 1138.51 + 569.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 2182 + + + NSTextField + NSView + NSWindowTemplate + NSMenu + NSMenuItem + NSTextFieldCell + NSButtonCell + IBNSLayoutConstraint + NSButton + NSCustomObject + + + com.apple.InterfaceBuilder.CocoaPlugin + + + PluginDependencyRecalculationVersion + + + + + NSApplication + + + FirstResponder + + + NSApplication + + + AMainMenu + + + + Second Life Crash Logger + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + Second Life Crash Logger + + + + About Second Life Crash Logger + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Preferences… + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Services + + 1048576 + 2147483647 + + + submenuAction: + + Services + + _NSServicesMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Hide Second Life Crash Logger + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Quit Second Life Crash Logger + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 1048576 + 2147483647 + + + submenuAction: + + File + + + + New + n + 1048576 + 2147483647 + + + + + + Open… + o + 1048576 + 2147483647 + + + + + + Open Recent + + 1048576 + 2147483647 + + + submenuAction: + + Open Recent + + + + Clear Menu + + 1048576 + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save… + s + 1048576 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + Print… + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 1048576 + 2147483647 + + + submenuAction: + + Edit + + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Paste and Match Style + V + 1572864 + 2147483647 + + + + + + Delete + + 1048576 + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Find + + 1048576 + 2147483647 + + + submenuAction: + + Find + + + + Find… + f + 1048576 + 2147483647 + + + 1 + + + + Find and Replace… + f + 1572864 + 2147483647 + + + 12 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 1048576 + 2147483647 + + + submenuAction: + + Spelling and Grammar + + + + Show Spelling and Grammar + : + 1048576 + 2147483647 + + + + + + Check Document Now + ; + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Check Spelling While Typing + + 1048576 + 2147483647 + + + + + + Check Grammar With Spelling + + 1048576 + 2147483647 + + + + + + Correct Spelling Automatically + + 2147483647 + + + + + + + + + Substitutions + + 1048576 + 2147483647 + + + submenuAction: + + Substitutions + + + + Show Substitutions + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Dashes + + 2147483647 + + + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + Text Replacement + + 2147483647 + + + + + + + + + Transformations + + 2147483647 + + + submenuAction: + + Transformations + + + + Make Upper Case + + 2147483647 + + + + + + Make Lower Case + + 2147483647 + + + + + + Capitalize + + 2147483647 + + + + + + + + + Speech + + 1048576 + 2147483647 + + + submenuAction: + + Speech + + + + Start Speaking + + 1048576 + 2147483647 + + + + + + Stop Speaking + + 1048576 + 2147483647 + + + + + + + + + + + + Format + + 2147483647 + + + submenuAction: + + Format + + + + Font + + 2147483647 + + + submenuAction: + + Font + + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Bold + b + 1048576 + 2147483647 + + + 2 + + + + Italic + i + 1048576 + 2147483647 + + + 1 + + + + Underline + u + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Bigger + + + 1048576 + 2147483647 + + + 3 + + + + Smaller + - + 1048576 + 2147483647 + + + 4 + + + + YES + YES + + + 2147483647 + + + + + + Kern + + 2147483647 + + + submenuAction: + + Kern + + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Tighten + + 2147483647 + + + + + + Loosen + + 2147483647 + + + + + + + + + Ligature + + 2147483647 + + + submenuAction: + + Ligature + + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Use All + + 2147483647 + + + + + + + + + Baseline + + 2147483647 + + + submenuAction: + + Baseline + + + + Use Default + + 2147483647 + + + + + + Superscript + + 2147483647 + + + + + + Subscript + + 2147483647 + + + + + + Raise + + 2147483647 + + + + + + Lower + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Colors + C + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Copy Style + c + 1572864 + 2147483647 + + + + + + Paste Style + v + 1572864 + 2147483647 + + + + + _NSFontMenu + + + + + Text + + 2147483647 + + + submenuAction: + + Text + + + + Align Left + { + 1048576 + 2147483647 + + + + + + Center + | + 1048576 + 2147483647 + + + + + + Justify + + 2147483647 + + + + + + Align Right + } + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Writing Direction + + 2147483647 + + + submenuAction: + + Writing Direction + + + + YES + Paragraph + + 2147483647 + + + + + + CURlZmF1bHQ + + 2147483647 + + + + + + CUxlZnQgdG8gUmlnaHQ + + 2147483647 + + + + + + CVJpZ2h0IHRvIExlZnQ + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + YES + Selection + + 2147483647 + + + + + + CURlZmF1bHQ + + 2147483647 + + + + + + CUxlZnQgdG8gUmlnaHQ + + 2147483647 + + + + + + CVJpZ2h0IHRvIExlZnQ + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Ruler + + 2147483647 + + + + + + Copy Ruler + c + 1310720 + 2147483647 + + + + + + Paste Ruler + v + 1310720 + 2147483647 + + + + + + + + + + + + View + + 1048576 + 2147483647 + + + submenuAction: + + View + + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Customize Toolbar… + + 1048576 + 2147483647 + + + + + + + + + Window + + 1048576 + 2147483647 + + + submenuAction: + + Window + + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Bring All to Front + + 1048576 + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 2147483647 + + + submenuAction: + + Help + + + + Second Life Crash Logger Help + ? + 1048576 + 2147483647 + + + + + _NSHelpMenu + + + + _NSMainMenu + + + 15 + 2 + {{335, 390}, {508, 477}} + 1954021376 + Second Life Crash Logger + NSWindow + + + + + 256 + + + + 268 + {{17, 228}, {474, 229}} + + + + _NS:9 + {250, 750} + YES + + 67239424 + 272891904 + + U2Vjb25kIExpZmUgYXBwZWFycyB0byBoYXZlIGNyYXNoZWQgb3IgZnJvemVuIHRoZSBsYXN0IHRpbWUg +aXQgcmFuLgoKVGhpcyBjcmFzaCByZXBvcnRlciBjb2xsZWN0cyBpbmZvcm1hdGlvbiBhYm91dCB5b3Vy +IGNvbXB1dGVyJ3MgaGFyZHdhcmUgY29uZmlndXJhdGlvbiwgb3BlcmF0aW5nIHN5c3RlbSwgYW5kIHNv +bWUgU2Vjb25kIExpZmUgbG9ncywgYWxsIG9mIHdoaWNoIGFyZSB1c2VkIGZvciBkZWJ1Z2dpbmcgcHVy +cG9zZXMgb25seS4KCkluIHRoZSBzcGFjZSBiZWxvdywgcGxlYXNlIGJyaWVmbHkgZGVzY3JpYmUgd2hh +dCB5b3Ugd2VyZSBkb2luZyBvciB0cnlpbmcgdG8gZG8ganVzdCBwcmlvciB0byB0aGUgY3Jhc2guICBU +aGFuayB5b3UgZm9yIHlvdXIgaGVscCEKClRoaXMgcmVwb3J0IGlzIE5PVCByZWFkIGJ5IEN1c3RvbWVy +IFN1cHBvcnQuICBJZiB5b3UgaGF2ZSBiaWxsaW5nIG9yIG90aGVyIHF1ZXN0aW9ucywgcGxlYXNlIGdv +IHRvOiBodHRwOi8vd3d3LnNlY29uZGxpZmUuY29tL3N1cHBvcnQvCgpJZiB5b3UgZG9uJ3Qgd2lzaCB0 +byBzZW5kIExpbmRlbiBMYWIgYSBjcmFzaCByZXBvcnQsIHByZXNzIENhbmNlbC4 + + + LucidaGrande + 13 + 16 + + _NS:9 + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2NjY3AA + + + + 6 + System + controlTextColor + + 3 + MAA + + + + + + + 268 + {{20, 64}, {468, 163}} + + + + _NS:9 + {250, 750} + YES + + -1805517311 + 272891904 + + + LucidaGrande + 9 + 3614 + + _NS:9 + + YES + + 6 + System + textBackgroundColor + + 3 + MQA + + + + 6 + System + textColor + + + + + + + 268 + {{16, 18}, {189, 30}} + + + + _NS:9 + YES + + -2080244224 + 262144 + Remember This Choice + + _NS:9 + + 1211912703 + 2 + + NSImage + NSSwitch + + + NSSwitch + + + + 200 + 25 + + + + + 268 + {{285, 23}, {91, 17}} + + + + _NS:9 + YES + + -2080244224 + 134479872 + Send Report + + _NS:9 + + -2038152961 + 164 + + + 400 + 75 + + + + + 268 + {{388, 23}, {100, 17}} + + + + _NS:9 + YES + + -2080244224 + 134479872 + Don't Send + + _NS:9 + + -2038152961 + 164 + + + 400 + 75 + + + + {508, 477} + + + + + {{0, 0}, {1680, 1028}} + {10000000000000, 10000000000000} + YES + + + LLCrashLoggerMacDelegate + + + + + + + terminate: + + + + 449 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + delegate + + + + 495 + + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + saveDocument: + + + + 362 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + unhideAllApplications: + + + + 370 + + + + newDocument: + + + + 373 + + + + openDocument: + + + + 374 + + + + raiseBaseline: + + + + 426 + + + + lowerBaseline: + + + + 427 + + + + copyFont: + + + + 428 + + + + subscript: + + + + 429 + + + + superscript: + + + + 430 + + + + tightenKerning: + + + + 431 + + + + underline: + + + + 432 + + + + orderFrontColorPanel: + + + + 433 + + + + useAllLigatures: + + + + 434 + + + + loosenKerning: + + + + 435 + + + + pasteFont: + + + + 436 + + + + unscript: + + + + 437 + + + + useStandardKerning: + + + + 438 + + + + useStandardLigatures: + + + + 439 + + + + turnOffLigatures: + + + + 440 + + + + turnOffKerning: + + + + 441 + + + + toggleAutomaticSpellingCorrection: + + + + 456 + + + + orderFrontSubstitutionsPanel: + + + + 458 + + + + toggleAutomaticDashSubstitution: + + + + 461 + + + + toggleAutomaticTextReplacement: + + + + 463 + + + + uppercaseWord: + + + + 464 + + + + capitalizeWord: + + + + 467 + + + + lowercaseWord: + + + + 468 + + + + pasteAsPlainText: + + + + 486 + + + + performFindPanelAction: + + + + 487 + + + + performFindPanelAction: + + + + 488 + + + + performFindPanelAction: + + + + 489 + + + + showHelp: + + + + 493 + + + + alignCenter: + + + + 518 + + + + pasteRuler: + + + + 519 + + + + toggleRuler: + + + + 520 + + + + alignRight: + + + + 521 + + + + copyRuler: + + + + 522 + + + + alignJustified: + + + + 523 + + + + alignLeft: + + + + 524 + + + + makeBaseWritingDirectionNatural: + + + + 525 + + + + makeBaseWritingDirectionLeftToRight: + + + + 526 + + + + makeBaseWritingDirectionRightToLeft: + + + + 527 + + + + makeTextWritingDirectionNatural: + + + + 528 + + + + makeTextWritingDirectionLeftToRight: + + + + 529 + + + + makeTextWritingDirectionRightToLeft: + + + + 530 + + + + performFindPanelAction: + + + + 535 + + + + window + + + + 532 + + + + remember: + + + + 1176 + + + + send: + + + + 1177 + + + + cancel: + + + + 1178 + + + + crashText + + + + 1179 + + + + rememberCheck + + + + 1187 + + + + + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + + + + + + + + + + + + 19 + + + + + + + + 56 + + + + + + + + 217 + + + + + + + + 83 + + + + + + + + 81 + + + + + + + + + + + + + + + + + 75 + + + + + 78 + + + + + 72 + + + + + 82 + + + + + 124 + + + + + + + + 77 + + + + + 73 + + + + + 79 + + + + + 112 + + + + + 74 + + + + + 125 + + + + + + + + 126 + + + + + 205 + + + + + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + + + + + + 216 + + + + + + + + 200 + + + + + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 57 + + + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + + + 144 + + + + + 129 + + + + + 143 + + + + + 236 + + + + + 131 + + + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + + + + + + 296 + + + + + + + + + 297 + + + + + 298 + + + + + 211 + + + + + + + + 212 + + + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + + + + + + 349 + + + + + + + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 371 + + + + + + + + 372 + + + + + + + + 3 + 0 + + 3 + 1 + + 20 + + 1000 + 8 + 29 + 3 + + + + + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + 8 + 29 + 3 + + + + + 5 + 0 + + 5 + 1 + + 20 + + 1000 + 8 + 29 + 3 + + + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + 8 + 29 + 3 + + + + + 5 + 0 + + 5 + 1 + + 20 + + 1000 + 8 + 29 + 3 + + + + + 4 + 0 + + 4 + 1 + + 64 + + 1000 + 3 + 9 + 3 + + + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + 8 + 29 + 3 + + + + + 5 + 0 + + 5 + 1 + + 20 + + 1000 + 8 + 29 + 3 + + + + + 4 + 0 + + 4 + 1 + + 21 + + 1000 + 3 + 9 + 3 + + + + + 6 + 0 + + 6 + 1 + + 132 + + 1000 + 3 + 9 + 3 + + + + + 11 + 0 + + 11 + 1 + + 0.0 + + 1000 + 6 + 24 + 2 + + + + + 10 + 0 + + 10 + 1 + + 0.0 + + 1000 + 6 + 24 + 2 + + + + + + + 375 + + + + + + + + 376 + + + + + + + + + 377 + + + + + + + + 388 + + + + + + + + + + + + + + + + + + + + + + + 389 + + + + + 390 + + + + + 391 + + + + + 392 + + + + + 393 + + + + + 394 + + + + + 395 + + + + + 396 + + + + + 397 + + + + + + + + 398 + + + + + + + + 399 + + + + + + + + 400 + + + + + 401 + + + + + 402 + + + + + 403 + + + + + 404 + + + + + 405 + + + + + + + + + + + + 406 + + + + + 407 + + + + + 408 + + + + + 409 + + + + + 410 + + + + + 411 + + + + + + + + + + 412 + + + + + 413 + + + + + 414 + + + + + 415 + + + + + + + + + + + 416 + + + + + 417 + + + + + 418 + + + + + 419 + + + + + 450 + + + + + + + + 451 + + + + + + + + + + 452 + + + + + 453 + + + + + 454 + + + + + 457 + + + + + 459 + + + + + 460 + + + + + 462 + + + + + 465 + + + + + 466 + + + + + 485 + + + + + 490 + + + + + + + + 491 + + + + + + + + 492 + + + + + 494 + + + + + 496 + + + + + + + + 497 + + + + + + + + + + + + + + + + + 498 + + + + + 499 + + + + + 500 + + + + + 501 + + + + + 502 + + + + + 503 + + + + + + + + 504 + + + + + 505 + + + + + 506 + + + + + 507 + + + + + 508 + + + + + + + + + + + + + + + + 509 + + + + + 510 + + + + + 511 + + + + + 512 + + + + + 513 + + + + + 514 + + + + + 515 + + + + + 516 + + + + + 517 + + + + + 534 + + + + + 536 + + + + + + 8 + 0 + + 0 + 1 + + 229 + + 1000 + 3 + 9 + 1 + + + + + + + 537 + + + + + 593 + + + + + + 8 + 0 + + 0 + 1 + + 163 + + 1000 + 3 + 9 + 1 + + + + + + + 594 + + + + + 727 + + + + + + 7 + 0 + + 0 + 1 + + 183 + + 1000 + 3 + 9 + 1 + + + + + 8 + 0 + + 0 + 1 + + 22 + + 1000 + 3 + 9 + 1 + + + + + + + 728 + + + + + 775 + + + + + + + + 776 + + + + + 780 + + + + + + 7 + 0 + + 0 + 1 + + 100 + + 1000 + 3 + 9 + 1 + + + + + + + 781 + + + + + 884 + + + + + 981 + + + + + 982 + + + + + 1022 + + + + + 1026 + + + + + 979 + + + + + 985 + + + + + 977 + + + + + 1099 + + + + + 1093 + + + + + 1100 + + + + + 1098 + + + + + 1168 + + + + + 1167 + + + + + 1095 + + + + + 1166 + + + + + 1076 + + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{380, 496}, {480, 360}} + + + + + + + + + + + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + + + 1187 + + + + + LLCrashLoggerMacDelegate + NSObject + + id + id + id + + + + cancel: + id + + + remember: + id + + + send: + id + + + + NSTextField + NSButton + NSWindow + + + + crashText + NSTextField + + + rememberCheck + NSButton + + + window + NSWindow + + + + IBProjectSource + ./Classes/LLCrashLoggerMacDelegate.h + + + + NSLayoutConstraint + NSObject + + IBProjectSource + ./Classes/NSLayoutConstraint.h + + + + + 0 + IBCocoaFramework + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + YES + 3 + + {11, 11} + {10, 3} + {15, 15} + + YES + + diff --git a/indra/mac_crash_logger/Info.plist b/indra/mac_crash_logger/Info.plist index f48293e825..2ebed11c3f 100644 --- a/indra/mac_crash_logger/Info.plist +++ b/indra/mac_crash_logger/Info.plist @@ -1,5 +1,5 @@ - + CFBundleDevelopmentRegion @@ -10,8 +10,6 @@ CFBundleIconFile - CFBundleIdentifier - com.secondlife.indra.crashreporter CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType @@ -22,5 +20,9 @@ ???? CFBundleVersion 1.0.0 + NSMainNibFile + CrashReporter + NSPrincipalClass + NSApplication diff --git a/indra/mac_crash_logger/llcrashloggermac.cpp b/indra/mac_crash_logger/llcrashloggermac.cpp index 8f1c1a2dd0..5d22b60136 100644 --- a/indra/mac_crash_logger/llcrashloggermac.cpp +++ b/indra/mac_crash_logger/llcrashloggermac.cpp @@ -27,7 +27,6 @@ #include "llcrashloggermac.h" -#include #include #include "indra_constants.h" // CRASH_BEHAVIOR_ASK, CRASH_SETTING_NAME @@ -38,102 +37,14 @@ #include "lldir.h" #include "llsdserialize.h" -#define MAX_LOADSTRING 100 -const char* const SETTINGS_FILE_HEADER = "version"; -const S32 SETTINGS_FILE_VERSION = 101; - // Windows Message Handlers -BOOL gFirstDialog = TRUE; // Are we currently handling the Send/Don't Send dialog? +BOOL gFirstDialog = TRUE; LLFILE *gDebugFile = NULL; -WindowRef gWindow = NULL; -EventHandlerRef gEventHandler = NULL; std::string gUserNotes = ""; bool gSendReport = false; bool gRememberChoice = false; -IBNibRef nib = NULL; - -OSStatus dialogHandler(EventHandlerCallRef handler, EventRef event, void *userdata) -{ - OSStatus result = eventNotHandledErr; - OSStatus err; - UInt32 evtClass = GetEventClass(event); - UInt32 evtKind = GetEventKind(event); - if((evtClass == kEventClassCommand) && (evtKind == kEventCommandProcess)) - { - HICommand cmd; - err = GetEventParameter(event, kEventParamDirectObject, typeHICommand, NULL, sizeof(cmd), NULL, &cmd); - - - - if(err == noErr) - { - //Get the value of the checkbox - ControlID id; - ControlRef checkBox = NULL; - id.signature = 'remb'; - id.id = 0; - err = GetControlByID(gWindow, &id, &checkBox); - - if(err == noErr) - { - if(GetControl32BitValue(checkBox) == kControlCheckBoxCheckedValue) - { - gRememberChoice = true; - } - else - { - gRememberChoice = false; - } - } - switch(cmd.commandID) - { - case kHICommandOK: - { - char buffer[65535]; /* Flawfinder: ignore */ - Size size = sizeof(buffer) - 1; - ControlRef textField = NULL; - - id.signature = 'text'; - id.id = 0; - - err = GetControlByID(gWindow, &id, &textField); - if(err == noErr) - { - // Get the user response text - err = GetControlData(textField, kControlNoPart, kControlEditTextTextTag, size, (Ptr)buffer, &size); - } - if(err == noErr) - { - // Make sure the string is terminated. - buffer[size] = 0; - gUserNotes = buffer; - - llinfos << buffer << llendl; - } - - // Send the report. - - QuitAppModalLoopForWindow(gWindow); - gSendReport = true; - result = noErr; - } - break; - - case kHICommandCancel: - QuitAppModalLoopForWindow(gWindow); - result = noErr; - break; - default: - result = eventNotHandledErr; - } - } - } - - return(result); -} - LLCrashLoggerMac::LLCrashLoggerMac(void) { @@ -146,73 +57,16 @@ LLCrashLoggerMac::~LLCrashLoggerMac(void) bool LLCrashLoggerMac::init(void) { bool ok = LLCrashLogger::init(); - if(!ok) return false; - if(mCrashBehavior != CRASH_BEHAVIOR_ASK) return true; - - // Real UI... - OSStatus err; - - err = CreateNibReference(CFSTR("CrashReporter"), &nib); - - if(err == noErr) - { - err = CreateWindowFromNib(nib, CFSTR("CrashReporter"), &gWindow); - } - - if(err == noErr) - { - // Set focus to the edit text area - ControlRef textField = NULL; - ControlID id; - - id.signature = 'text'; - id.id = 0; - - // Don't set err if any of this fails, since it's non-critical. - if(GetControlByID(gWindow, &id, &textField) == noErr) - { - SetKeyboardFocus(gWindow, textField, kControlFocusNextPart); - } - } - - if(err == noErr) - { - ShowWindow(gWindow); - } - - if(err == noErr) - { - // Set up an event handler for the window. - EventTypeSpec handlerEvents[] = - { - { kEventClassCommand, kEventCommandProcess } - }; - - InstallWindowEventHandler( - gWindow, - NewEventHandlerUPP(dialogHandler), - GetEventTypeCount (handlerEvents), - handlerEvents, - 0, - &gEventHandler); - } - return true; + return ok; } void LLCrashLoggerMac::gatherPlatformSpecificFiles() { - updateApplication("Gathering hardware information..."); } bool LLCrashLoggerMac::mainLoop() { - OSStatus err = noErr; - - if(err == noErr && mCrashBehavior == CRASH_BEHAVIOR_ASK) - { - RunAppModalLoopForWindow(gWindow); - } - else if (mCrashBehavior == CRASH_BEHAVIOR_ALWAYS_SEND) + if (mCrashBehavior == CRASH_BEHAVIOR_ALWAYS_SEND) { gSendReport = true; } @@ -229,24 +83,9 @@ bool LLCrashLoggerMac::mainLoop() sendCrashLogs(); } - if(gWindow != NULL) - { - DisposeWindow(gWindow); - } - - if(nib != NULL) - { - DisposeNibReference(nib); - } - return true; } -void LLCrashLoggerMac::updateApplication(const std::string& message) -{ - LLCrashLogger::updateApplication(message); -} - bool LLCrashLoggerMac::cleanup() { commonCleanup(); diff --git a/indra/mac_crash_logger/llcrashloggermac.h b/indra/mac_crash_logger/llcrashloggermac.h index 4b1d235f24..6d8f63ecac 100644 --- a/indra/mac_crash_logger/llcrashloggermac.h +++ b/indra/mac_crash_logger/llcrashloggermac.h @@ -38,7 +38,6 @@ public: ~LLCrashLoggerMac(void); virtual bool init(); virtual bool mainLoop(); - virtual void updateApplication(const std::string& message = LLStringUtil::null); virtual bool cleanup(); virtual void gatherPlatformSpecificFiles(); }; diff --git a/indra/mac_crash_logger/llcrashloggermacdelegate.h b/indra/mac_crash_logger/llcrashloggermacdelegate.h new file mode 100644 index 0000000000..8557b77e7d --- /dev/null +++ b/indra/mac_crash_logger/llcrashloggermacdelegate.h @@ -0,0 +1,50 @@ +/** + * @file llcrashloggermacdelegate.h + * @brief Mac OSX crash logger implementation + * + * $LicenseInfo:firstyear=2003&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +/* +#import + +@interface LLCrashLoggerMacDelegate : NSObject +{ + IBOutlet NSTextField *crashText; + IBOutlet NSButton *rememberCheck; + + NSWindow *_window; + bool mRemember; + +} + +- (void)setWindow:(NSWindow *)newWindow; +- (NSWindow *)window; + +- (IBAction)remember:(id)sender; +- (IBAction)send:(id)sender; +- (IBAction)cancel:(id)sender; + +@property (assign) IBOutlet NSWindow *window; + +@end +*/ \ No newline at end of file diff --git a/indra/mac_crash_logger/llcrashloggermacdelegate.mm b/indra/mac_crash_logger/llcrashloggermacdelegate.mm new file mode 100644 index 0000000000..b2af76a47c --- /dev/null +++ b/indra/mac_crash_logger/llcrashloggermacdelegate.mm @@ -0,0 +1,75 @@ +/** + * @file llcrashloggermacdelegate.mm + * @brief Mac OSX crash logger implementation + * + * $LicenseInfo:firstyear=2003&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + + +/* +#import "llcrashloggermacdelegate.h" +#include + +extern std::string gUserNotes; +extern bool gSendReport; +extern bool gRememberChoice; + +@implementation LLCrashLoggerMacDelegate + +- (void)setWindow:(NSWindow *)window +{ + _window = window; +} + +- (NSWindow *)window +{ + return _window; +} + +- (void)dealloc +{ + [super dealloc]; +} + +std::string* NSToString( NSString *ns_str ) +{ + return ( new std::string([ns_str UTF8String]) ); +} + +- (IBAction)remember:(id)sender +{ + gRememberChoice = [rememberCheck state]; +} + +- (IBAction)send:(id)sender +{ + std::string* user_input = NSToString([crashText stringValue]); + gUserNotes = *user_input; + gSendReport = true; +} + +- (IBAction)cancel:(id)sender +{ + [ _window close]; +} +@end +*/ \ No newline at end of file diff --git a/indra/mac_crash_logger/mac_crash_logger.cpp b/indra/mac_crash_logger/mac_crash_logger.cpp index 6571b35241..4d0a7af27f 100644 --- a/indra/mac_crash_logger/mac_crash_logger.cpp +++ b/indra/mac_crash_logger/mac_crash_logger.cpp @@ -26,9 +26,18 @@ #include "linden_common.h" #include "llcrashloggermac.h" +#include "indra_constants.h" +#include +#include + + int main(int argc, char **argv) { + std::ofstream outputFile; + outputFile.open("/tmp/aura.txt"); + outputFile << "TEstiNG" << std::endl; + llinfos << "SPATTERS ASDFSDFSDF" << llendl; llinfos << "Starting crash reporter." << llendl; LLCrashLoggerMac app; @@ -39,9 +48,16 @@ int main(int argc, char **argv) llwarns << "Unable to initialize application." << llendl; return 1; } - + if (app.getCrashBehavior() != CRASH_BEHAVIOR_ALWAYS_SEND) + { + +// return NSApplicationMain(argc, (const char **)argv); + } app.mainLoop(); app.cleanup(); llinfos << "Crash reporter finished normally." << llendl; + + outputFile.close(); + return 0; } -- cgit v1.2.3 From eca619985206462d39dc9ae665857e97948562da Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Mon, 12 Nov 2012 18:06:32 -0800 Subject: Ported slplugin and some other missing components for cocoa. --- indra/llplugin/slplugin/CMakeLists.txt | 3 +- indra/llplugin/slplugin/slplugin-objc.h | 22 +- indra/llplugin/slplugin/slplugin-objc.mm | 101 ++++++++- indra/llplugin/slplugin/slplugin.cpp | 131 ++---------- indra/llvfs/CMakeLists.txt | 6 +- indra/llvfs/lldir.h | 6 +- indra/llvfs/lldir_linux.cpp | 2 +- indra/llvfs/lldir_linux.h | 2 +- indra/llvfs/lldir_mac.cpp | 237 ++++++--------------- indra/llvfs/lldir_mac.h | 10 +- indra/llvfs/lldir_solaris.cpp | 2 +- indra/llvfs/lldir_solaris.h | 2 +- indra/llvfs/lldir_win32.cpp | 2 +- indra/llvfs/lldir_win32.h | 2 +- indra/newview/tests/lldir_stub.cpp | 2 +- .../updater/tests/llupdaterservice_test.cpp | 2 +- 16 files changed, 226 insertions(+), 306 deletions(-) diff --git a/indra/llplugin/slplugin/CMakeLists.txt b/indra/llplugin/slplugin/CMakeLists.txt index 3fc54573a7..8183467dc5 100644 --- a/indra/llplugin/slplugin/CMakeLists.txt +++ b/indra/llplugin/slplugin/CMakeLists.txt @@ -15,7 +15,6 @@ include_directories( if (DARWIN) include(CMakeFindFrameworks) - find_library(CARBON_LIBRARY Carbon) find_library(COCOA_LIBRARY Cocoa) endif (DARWIN) @@ -68,7 +67,7 @@ add_dependencies(SLPlugin if (DARWIN) # Mac version needs to link against Carbon - target_link_libraries(SLPlugin ${CARBON_LIBRARY} ${COCOA_LIBRARY}) + target_link_libraries(SLPlugin ${COCOA_LIBRARY}) # Make sure the app bundle has a Resources directory (it will get populated by viewer-manifest.py later) add_custom_command( TARGET SLPlugin POST_BUILD diff --git a/indra/llplugin/slplugin/slplugin-objc.h b/indra/llplugin/slplugin/slplugin-objc.h index 602d848f7e..9a8e81873f 100644 --- a/indra/llplugin/slplugin/slplugin-objc.h +++ b/indra/llplugin/slplugin/slplugin-objc.h @@ -28,8 +28,24 @@ * @endcond */ +//Protos for ObjectiveC classes (cannot import cocoa here due to BOOL conflict) +class NSWindow; /* Defined in slplugin-objc.mm: */ -void setupCocoa(); -void createAutoReleasePool(); -void deleteAutoReleasePool(); + +class LLCocoaPlugin +{ +public: + LLCocoaPlugin(); + void setupCocoa(); + void createAutoReleasePool(); + void deleteAutoReleasePool(); + void setupGroup(); + void updateWindows(); + void processEvents(); +public: + //EventTargetRef mEventTarget; + NSWindow* mFrontWindow; + NSWindow* mPluginWindow; + int mHackState; +}; \ No newline at end of file diff --git a/indra/llplugin/slplugin/slplugin-objc.mm b/indra/llplugin/slplugin/slplugin-objc.mm index 646416b9d2..a434739350 100644 --- a/indra/llplugin/slplugin/slplugin-objc.mm +++ b/indra/llplugin/slplugin/slplugin-objc.mm @@ -30,11 +30,13 @@ #include +#import #include "slplugin-objc.h" +//Note: NSApp is a global defined by cocoa which is an id to the application. -void setupCocoa() +void LLCocoaPlugin::setupCocoa() { static bool inited = false; @@ -56,6 +58,8 @@ void setupCocoa() // Must first call [[[NSWindow alloc] init] release] to get the NSWindow machinery set up so that NSCursor can use a window to cache the cursor image [[[NSWindow alloc] init] release]; + mPluginWindow = [NSApp mainWindow]; + deleteAutoReleasePool(); inited = true; @@ -64,7 +68,7 @@ void setupCocoa() static NSAutoreleasePool *sPool = NULL; -void createAutoReleasePool() +void LLCocoaPlugin::createAutoReleasePool() { if(!sPool) { @@ -72,7 +76,7 @@ void createAutoReleasePool() } } -void deleteAutoReleasePool() +void LLCocoaPlugin::deleteAutoReleasePool() { if(sPool) { @@ -80,3 +84,94 @@ void deleteAutoReleasePool() sPool = NULL; } } + +LLCocoaPlugin::LLCocoaPlugin():mHackState(0) +{ + NSArray* window_list = [NSApp orderedWindows]; + mFrontWindow = [window_list objectAtIndex:0]; +} + +void LLCocoaPlugin::processEvents() +{ + // Some plugins (webkit at least) will want an event loop. This qualifies. + NSEvent * event; + event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES]; + [NSApp sendEvent: event]; +} + + +//Turns out the window ordering stuff never gets hit with any of the current plugins. +//Leaving the following code here 'just in case' for the time being. + +void LLCocoaPlugin::setupGroup() +{ + // CreateWindowGroup(kWindowGroupAttrFixedLevel, &layer_group); + // if(layer_group) + // { + // // Start out with a window layer that's way out in front (fixes the problem with the menubar not getting hidden on first switch to fullscreen youtube) + // SetWindowGroupName(layer_group, CFSTR("SLPlugin Layer")); + // SetWindowGroupLevel(layer_group, kCGOverlayWindowLevel); + // } + +} + +void LLCocoaPlugin::updateWindows() //SPATTERS give this a better name. +{ +// NSArray* window_list = [NSApp orderedWindows]; +// NSWindow* current_window = [window_list objectAtIndex:0]; +// NSWindow* parent_window = [ current_window parentWindow ]; +// bool this_is_front_process = false; +// bool parent_is_front_process = false; +// +// +// // Check for a change in this process's frontmost window. +// if ( current_window != mFrontWindow ) +// { +// // and figure out whether this process or its parent are currently frontmost +// if ( current_window == parent_window ) parent_is_front_process = true; +// if ( current_window == mPluginWindow ) this_is_front_process = true; +// +// if (current_window != NULL && mFrontWindow == NULL) +// { +// // Opening the first window +// +// if(mHackState == 0) +// { +// // Next time through the event loop, lower the window group layer +// mHackState = 1; +// } +// +// if(parent_is_front_process) +// { +// // Bring this process's windows to the front. +// [mPluginWindow makeKeyAndOrderFront:NSApp]; +// [mPluginWindow setOrderedIndex:0]; +// } +// +// [NSApp activateIgnoringOtherApps:YES]; +// } +// +// else if (( current_window == NULL) && (mFrontWindow != NULL)) +// { +// // Closing the last window +// +// if(this_is_front_process) +// { +// // Try to bring this process's parent to the front +// [parent_window makeKeyAndOrderFront:NSApp]; +// [parent_window setOrderedIndex:0]; +// } +// } +// else if(mHackState == 1) +// { +//// if(layer_group) +//// { +//// // Set the window group level back to something less extreme +//// SetWindowGroupLevel(layer_group, kCGNormalWindowLevel); +//// } +// mHackState = 2; +// } +// +// mFrontWindow = [window_list objectAtIndex:0]; +// } + } diff --git a/indra/llplugin/slplugin/slplugin.cpp b/indra/llplugin/slplugin/slplugin.cpp index 516a58db88..6c9ba0ae52 100644 --- a/indra/llplugin/slplugin/slplugin.cpp +++ b/indra/llplugin/slplugin/slplugin.cpp @@ -37,8 +37,12 @@ #include "llapr.h" #include "llstring.h" +#include +#include +using namespace std; + + #if LL_DARWIN - #include #include "slplugin-objc.h" #endif @@ -176,6 +180,7 @@ int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL int main(int argc, char **argv) #endif { + ll_init_apr(); // Set up llerror logging @@ -216,26 +221,25 @@ int main(int argc, char **argv) // Catch signals that most kinds of crashes will generate, and exit cleanly so the system crash dialog isn't shown. signal(SIGILL, &crash_handler); // illegal instruction -# if LL_DARWIN - signal(SIGEMT, &crash_handler); // emulate instruction executed -# endif // LL_DARWIN signal(SIGFPE, &crash_handler); // floating-point exception signal(SIGBUS, &crash_handler); // bus error signal(SIGSEGV, &crash_handler); // segmentation violation signal(SIGSYS, &crash_handler); // non-existent system call invoked #endif +# if LL_DARWIN + signal(SIGEMT, &crash_handler); // emulate instruction executed -#if LL_DARWIN - setupCocoa(); - createAutoReleasePool(); -#endif + LLCocoaPlugin cocoa_interface; + cocoa_interface.setupCocoa(); + cocoa_interface.createAutoReleasePool(); +#endif //LL_DARWIN LLPluginProcessChild *plugin = new LLPluginProcessChild(); plugin->init(port); #if LL_DARWIN - deleteAutoReleasePool(); + cocoa_interface.deleteAutoReleasePool(); #endif LLTimer timer; @@ -246,114 +250,22 @@ int main(int argc, char **argv) #endif #if LL_DARWIN + // If the plugin opens a new window (such as the Flash plugin's fullscreen player), we may need to bring this plugin process to the foreground. // Use this to track the current frontmost window and bring this process to the front if it changes. - WindowRef front_window = NULL; - WindowGroupRef layer_group = NULL; - int window_hack_state = 0; - CreateWindowGroup(kWindowGroupAttrFixedLevel, &layer_group); - if(layer_group) - { - // Start out with a window layer that's way out in front (fixes the problem with the menubar not getting hidden on first switch to fullscreen youtube) - SetWindowGroupName(layer_group, CFSTR("SLPlugin Layer")); - SetWindowGroupLevel(layer_group, kCGOverlayWindowLevel); - } -#endif - -#if LL_DARWIN - EventTargetRef event_target = GetEventDispatcherTarget(); + // cocoa_interface.mEventTarget = GetEventDispatcherTarget(); #endif while(!plugin->isDone()) { #if LL_DARWIN - createAutoReleasePool(); + cocoa_interface.createAutoReleasePool(); #endif timer.reset(); plugin->idle(); #if LL_DARWIN { - // Some plugins (webkit at least) will want an event loop. This qualifies. - EventRef event; - if(ReceiveNextEvent(0, 0, kEventDurationNoWait, true, &event) == noErr) - { - SendEventToEventTarget (event, event_target); - ReleaseEvent(event); - } - - // Check for a change in this process's frontmost window. - if(GetFrontWindowOfClass(kAllWindowClasses, true) != front_window) - { - ProcessSerialNumber self = { 0, kCurrentProcess }; - ProcessSerialNumber parent = { 0, kNoProcess }; - ProcessSerialNumber front = { 0, kNoProcess }; - Boolean this_is_front_process = false; - Boolean parent_is_front_process = false; - { - // Get this process's parent - ProcessInfoRec info; - info.processInfoLength = sizeof(ProcessInfoRec); - info.processName = NULL; - info.processAppSpec = NULL; - if(GetProcessInformation( &self, &info ) == noErr) - { - parent = info.processLauncher; - } - - // and figure out whether this process or its parent are currently frontmost - if(GetFrontProcess(&front) == noErr) - { - (void) SameProcess(&self, &front, &this_is_front_process); - (void) SameProcess(&parent, &front, &parent_is_front_process); - } - } - - if((GetFrontWindowOfClass(kAllWindowClasses, true) != NULL) && (front_window == NULL)) - { - // Opening the first window - - if(window_hack_state == 0) - { - // Next time through the event loop, lower the window group layer - window_hack_state = 1; - } - - if(layer_group) - { - SetWindowGroup(GetFrontWindowOfClass(kAllWindowClasses, true), layer_group); - } - - if(parent_is_front_process) - { - // Bring this process's windows to the front. - (void) SetFrontProcess( &self ); - } - - ActivateWindow(GetFrontWindowOfClass(kAllWindowClasses, true), true); - } - else if((GetFrontWindowOfClass(kAllWindowClasses, true) == NULL) && (front_window != NULL)) - { - // Closing the last window - - if(this_is_front_process) - { - // Try to bring this process's parent to the front - (void) SetFrontProcess(&parent); - } - } - else if(window_hack_state == 1) - { - if(layer_group) - { - // Set the window group level back to something less extreme - SetWindowGroupLevel(layer_group, kCGNormalWindowLevel); - } - window_hack_state = 2; - } - - front_window = GetFrontWindowOfClass(kAllWindowClasses, true); - - } - } + cocoa_interface.processEvents(); + } #endif F64 elapsed = timer.getElapsedTimeF64(); F64 remaining = plugin->getSleepTime() - elapsed; @@ -377,7 +289,8 @@ int main(int argc, char **argv) // LL_INFOS("slplugin") << "slept for "<< timer.getElapsedTimeF64() * 1000.0f << " ms" << LL_ENDL; } - + + #if LL_WINDOWS // More agressive checking of interfering exception handlers. // Doesn't appear to be required so far - even for plugins @@ -387,14 +300,14 @@ int main(int argc, char **argv) #endif #if LL_DARWIN - deleteAutoReleasePool(); + cocoa_interface.deleteAutoReleasePool(); #endif } - delete plugin; ll_cleanup_apr(); + return 0; } diff --git a/indra/llvfs/CMakeLists.txt b/indra/llvfs/CMakeLists.txt index a819d12861..3c68b279f7 100644 --- a/indra/llvfs/CMakeLists.txt +++ b/indra/llvfs/CMakeLists.txt @@ -36,6 +36,8 @@ set(llvfs_HEADER_FILES if (DARWIN) LIST(APPEND llvfs_SOURCE_FILES lldir_mac.cpp) LIST(APPEND llvfs_HEADER_FILES lldir_mac.h) + LIST(APPEND llvfs_SOURCE_FILES llvfs_objc.mm) + LIST(APPEND llvfs_HEADER_FILES llvfs_objc.h) endif (DARWIN) if (LINUX) @@ -73,8 +75,8 @@ target_link_libraries(llvfs if (DARWIN) include(CMakeFindFrameworks) - find_library(CARBON_LIBRARY Carbon) - target_link_libraries(llvfs ${CARBON_LIBRARY}) + find_library(COCOA_LIBRARY Cocoa) + target_link_libraries(llvfs ${COCOA_LIBRARY}) endif (DARWIN) diff --git a/indra/llvfs/lldir.h b/indra/llvfs/lldir.h index 5ee8bdb542..35b2654ae7 100644 --- a/indra/llvfs/lldir.h +++ b/indra/llvfs/lldir.h @@ -1,4 +1,4 @@ -/** +/** * @file lldir.h * @brief Definition of directory utilities class * @@ -73,10 +73,8 @@ class LLDir virtual S32 deleteFilesInDir(const std::string &dirname, const std::string &mask); // pure virtual functions - virtual U32 countFilesInDir(const std::string &dirname, const std::string &mask) = 0; - virtual std::string getCurPath() = 0; - virtual BOOL fileExists(const std::string &filename) const = 0; + virtual bool fileExists(const std::string &filename) const = 0; const std::string findFile(const std::string& filename, const std::vector filenames) const; const std::string findFile(const std::string& filename, const std::string& searchPath1 = "", const std::string& searchPath2 = "", const std::string& searchPath3 = "") const; diff --git a/indra/llvfs/lldir_linux.cpp b/indra/llvfs/lldir_linux.cpp index 407f3b93fb..4edd078640 100644 --- a/indra/llvfs/lldir_linux.cpp +++ b/indra/llvfs/lldir_linux.cpp @@ -254,7 +254,7 @@ std::string LLDir_Linux::getCurPath() } -BOOL LLDir_Linux::fileExists(const std::string &filename) const +bool LLDir_Linux::fileExists(const std::string &filename) const { struct stat stat_data; // Check the age of the file diff --git a/indra/llvfs/lldir_linux.h b/indra/llvfs/lldir_linux.h index 7603239867..e83a020ba4 100644 --- a/indra/llvfs/lldir_linux.h +++ b/indra/llvfs/lldir_linux.h @@ -47,7 +47,7 @@ public: virtual std::string getCurPath(); virtual U32 countFilesInDir(const std::string &dirname, const std::string &mask); - /*virtual*/ BOOL fileExists(const std::string &filename) const; + /*virtual*/ bool fileExists(const std::string &filename) const; /*virtual*/ std::string getLLPluginLauncher(); /*virtual*/ std::string getLLPluginFilename(std::string base_name); diff --git a/indra/llvfs/lldir_mac.cpp b/indra/llvfs/lldir_mac.cpp index 489bc3e4a7..75b3d56ebc 100644 --- a/indra/llvfs/lldir_mac.cpp +++ b/indra/llvfs/lldir_mac.cpp @@ -22,7 +22,7 @@ * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ - */ + */ #if LL_DARWIN @@ -35,73 +35,27 @@ #include #include #include - -#include - -// -------------------------------------------------------------------------------- - -static OSStatus CFCreateDirectory(FSRef *parentRef, CFStringRef name, FSRef *newRef) -{ - OSStatus result = noErr; - HFSUniStr255 uniStr; - - uniStr.length = CFStringGetLength(name); - CFStringGetCharacters(name, CFRangeMake(0, uniStr.length), uniStr.unicode); - result = FSMakeFSRefUnicode(parentRef, uniStr.length, uniStr.unicode, kTextEncodingMacRoman, newRef); - if (result != noErr) - { - result = FSCreateDirectoryUnicode(parentRef, uniStr.length, uniStr.unicode, 0, NULL, newRef, NULL, NULL); - } - - return result; -} +#include +#include "llvfs_objc.h" // -------------------------------------------------------------------------------- -static void CFStringRefToLLString(CFStringRef stringRef, std::string &llString, bool releaseWhenDone) +static bool CreateDirectory(const std::string &parent, + const std::string &child, + std::string *fullname) { - if (stringRef) - { - long stringSize = CFStringGetLength(stringRef) + 1; - long bufferSize = CFStringGetMaximumSizeForEncoding(stringSize,kCFStringEncodingUTF8); - char* buffer = new char[bufferSize]; - memset(buffer, 0, bufferSize); - if (CFStringGetCString(stringRef, buffer, bufferSize, kCFStringEncodingUTF8)) - llString = buffer; - delete[] buffer; - if (releaseWhenDone) - CFRelease(stringRef); - } -} - -// -------------------------------------------------------------------------------- - -static void CFURLRefToLLString(CFURLRef urlRef, std::string &llString, bool releaseWhenDone) -{ - if (urlRef) - { - CFURLRef absoluteURLRef = CFURLCopyAbsoluteURL(urlRef); - if (absoluteURLRef) - { - CFStringRef stringRef = CFURLCopyFileSystemPath(absoluteURLRef, kCFURLPOSIXPathStyle); - CFStringRefToLLString(stringRef, llString, true); - CFRelease(absoluteURLRef); - } - if (releaseWhenDone) - CFRelease(urlRef); - } -} - -// -------------------------------------------------------------------------------- - -static void FSRefToLLString(FSRef *fsRef, std::string &llString) -{ - OSStatus error = noErr; - char path[MAX_PATH]; - - error = FSRefMakePath(fsRef, (UInt8*) path, sizeof(path)); - if (error == noErr) - llString = path; + + boost::filesystem::path p(parent); + p /= child; + + if (fullname) + *fullname = std::string(p.string()); + + if (! boost::filesystem::create_directory(p)) + { + return (boost::filesystem::is_directory(p)); + } + return true; } // -------------------------------------------------------------------------------- @@ -109,35 +63,26 @@ static void FSRefToLLString(FSRef *fsRef, std::string &llString) LLDir_Mac::LLDir_Mac() { mDirDelimiter = "/"; - mCurrentDirIndex = -1; - mCurrentDirCount = -1; - - CFBundleRef mainBundleRef = NULL; - CFURLRef executableURLRef = NULL; - CFStringRef stringRef = NULL; - OSStatus error = noErr; - FSRef fileRef; - CFStringRef secondLifeString = CFSTR("SecondLife"); - - mainBundleRef = CFBundleGetMainBundle(); - - executableURLRef = CFBundleCopyExecutableURL(mainBundleRef); - - if (executableURLRef != NULL) + + const std::string secondLifeString = "SecondLife"; + + std::string *executablepathstr = getSystemExecutableFolder(); + + //NOTE: LLINFOS/LLERRS will not output to log here. The streams are not initialized. + + if (executablepathstr) { // mExecutablePathAndName - CFURLRefToLLString(executableURLRef, mExecutablePathAndName, false); - - // mExecutableFilename - stringRef = CFURLCopyLastPathComponent(executableURLRef); - CFStringRefToLLString(stringRef, mExecutableFilename, true); - - // mExecutableDir - CFURLRef executableParentURLRef = CFURLCreateCopyDeletingLastPathComponent(NULL, executableURLRef); - CFURLRefToLLString(executableParentURLRef, mExecutableDir, true); + mExecutablePathAndName = *executablepathstr; + + boost::filesystem::path executablepath(*executablepathstr); + + mExecutableFilename = executablepath.filename(); + mExecutableDir = executablepath.parent_path().string(); // mAppRODataDir - + std::string *resourcepath = getSystemResourceFolder(); + mAppRODataDir = *resourcepath; // *NOTE: When running in a dev tree, use the copy of // skins in indra/newview/ rather than in the application bundle. This @@ -146,10 +91,7 @@ LLDir_Mac::LLDir_Mac() // MBW -- This keeps the mac application from finding other things. // If this is really for skins, it should JUST apply to skins. - - CFURLRef resourcesURLRef = CFBundleCopyResourcesDirectoryURL(mainBundleRef); - CFURLRefToLLString(resourcesURLRef, mAppRODataDir, true); - + U32 build_dir_pos = mExecutableDir.rfind("/build-darwin-"); if (build_dir_pos != std::string::npos) { @@ -166,55 +108,50 @@ LLDir_Mac::LLDir_Mac() } // mOSUserDir - error = FSFindFolder(kUserDomain, kApplicationSupportFolderType, true, &fileRef); - if (error == noErr) - { - FSRef newFileRef; - - // Create the directory - error = CFCreateDirectory(&fileRef, secondLifeString, &newFileRef); - if (error == noErr) - { - // Save the full path to the folder - FSRefToLLString(&newFileRef, mOSUserDir); - - // Create our sub-dirs - (void) CFCreateDirectory(&newFileRef, CFSTR("data"), NULL); - //(void) CFCreateDirectory(&newFileRef, CFSTR("cache"), NULL); - (void) CFCreateDirectory(&newFileRef, CFSTR("logs"), NULL); - (void) CFCreateDirectory(&newFileRef, CFSTR("user_settings"), NULL); - (void) CFCreateDirectory(&newFileRef, CFSTR("browser_profile"), NULL); - } - } - + std::string *appdir = getSystemApplicationSupportFolder(); + std::string rootdir; + + //Create root directory + if (CreateDirectory(*appdir, secondLifeString, &rootdir)) + { + + // Save the full path to the folder + mOSUserDir = rootdir; + + // Create our sub-dirs + CreateDirectory(rootdir, std::string("data"), NULL); + CreateDirectory(rootdir, std::string("logs"), NULL); + CreateDirectory(rootdir, std::string("user_settings"), NULL); + CreateDirectory(rootdir, std::string("browser_profile"), NULL); + } + //mOSCacheDir - FSRef cacheDirRef; - error = FSFindFolder(kUserDomain, kCachedDataFolderType, true, &cacheDirRef); - if (error == noErr) + std::string *cachedir = getSystemCacheFolder(); + + if (cachedir) + { - FSRefToLLString(&cacheDirRef, mOSCacheDir); - (void)CFCreateDirectory(&cacheDirRef, CFSTR("SecondLife"),NULL); + mOSCacheDir = *cachedir; + //SPATTERS TODO: This changes from ~/Library/Cache/Secondlife to ~/Library/Cache/com.app.secondlife/Secondlife. Last dir level could go away. + CreateDirectory(mOSCacheDir, secondLifeString, NULL); } // mOSUserAppDir mOSUserAppDir = mOSUserDir; // mTempDir - error = FSFindFolder(kOnAppropriateDisk, kTemporaryFolderType, true, &fileRef); - if (error == noErr) - { - FSRef tempRef; - error = CFCreateDirectory(&fileRef, secondLifeString, &tempRef); - if (error == noErr) - FSRefToLLString(&tempRef, mTempDir); - } + //Aura 120920 boost::filesystem::temp_directory_path() not yet implemented on mac. :( + std::string *tmpdir = getSystemTempFolder(); + if (tmpdir) + { + + CreateDirectory(*tmpdir, secondLifeString, &mTempDir); + if (tmpdir) delete tmpdir; + } mWorkingDir = getCurPath(); mLLPluginDir = mAppRODataDir + mDirDelimiter + "llplugin"; - - CFRelease(executableURLRef); - executableURLRef = NULL; } } @@ -235,52 +172,18 @@ void LLDir_Mac::initAppDirs(const std::string &app_name, mSkinBaseDir = mAppRODataDir + mDirDelimiter + "skins"; } mCAFile = getExpandedFilename(LL_PATH_APP_SETTINGS, "CA.pem"); - - //dumpCurrentDirectories(); -} - -U32 LLDir_Mac::countFilesInDir(const std::string &dirname, const std::string &mask) -{ - U32 file_count = 0; - glob_t g; - - std::string tmp_str; - tmp_str = dirname; - tmp_str += mask; - - if(glob(tmp_str.c_str(), GLOB_NOSORT, NULL, &g) == 0) - { - file_count = g.gl_pathc; - - globfree(&g); - } - - return (file_count); } std::string LLDir_Mac::getCurPath() { - char tmp_str[LL_MAX_PATH]; /* Flawfinder: ignore */ - getcwd(tmp_str, LL_MAX_PATH); - return tmp_str; + return boost::filesystem::path( boost::filesystem::current_path() ).string(); } -BOOL LLDir_Mac::fileExists(const std::string &filename) const +bool LLDir_Mac::fileExists(const std::string &filename) const { - struct stat stat_data; - // Check the age of the file - // Now, we see if the files we've gathered are recent... - int res = stat(filename.c_str(), &stat_data); - if (!res) - { - return TRUE; - } - else - { - return FALSE; - } + return boost::filesystem::exists(filename); } diff --git a/indra/llvfs/lldir_mac.h b/indra/llvfs/lldir_mac.h index d190d70be4..558727ebbc 100644 --- a/indra/llvfs/lldir_mac.h +++ b/indra/llvfs/lldir_mac.h @@ -22,7 +22,7 @@ * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ - */ + */ #if !LL_DARWIN #error This header must not be included when compiling for any target other than Mac OS. Consider including lldir.h instead. @@ -45,16 +45,10 @@ public: const std::string& app_read_only_data_dir); virtual std::string getCurPath(); - virtual U32 countFilesInDir(const std::string &dirname, const std::string &mask); - virtual BOOL fileExists(const std::string &filename) const; + virtual bool fileExists(const std::string &filename) const; /*virtual*/ std::string getLLPluginLauncher(); /*virtual*/ std::string getLLPluginFilename(std::string base_name); - -private: - int mCurrentDirIndex; - int mCurrentDirCount; - std::string mCurrentDir; }; #endif // LL_LLDIR_MAC_H diff --git a/indra/llvfs/lldir_solaris.cpp b/indra/llvfs/lldir_solaris.cpp index 21f8c3acdb..a97d72d539 100644 --- a/indra/llvfs/lldir_solaris.cpp +++ b/indra/llvfs/lldir_solaris.cpp @@ -272,7 +272,7 @@ std::string LLDir_Solaris::getCurPath() } -BOOL LLDir_Solaris::fileExists(const std::string &filename) const +bool LLDir_Solaris::fileExists(const std::string &filename) const { struct stat stat_data; // Check the age of the file diff --git a/indra/llvfs/lldir_solaris.h b/indra/llvfs/lldir_solaris.h index 0b58a45b15..c6dac57e14 100644 --- a/indra/llvfs/lldir_solaris.h +++ b/indra/llvfs/lldir_solaris.h @@ -47,7 +47,7 @@ public: virtual std::string getCurPath(); virtual U32 countFilesInDir(const std::string &dirname, const std::string &mask); - /*virtual*/ BOOL fileExists(const std::string &filename) const; + /*virtual*/ bool fileExists(const std::string &filename) const; private: DIR *mDirp; diff --git a/indra/llvfs/lldir_win32.cpp b/indra/llvfs/lldir_win32.cpp index 7709945123..462d1cce06 100644 --- a/indra/llvfs/lldir_win32.cpp +++ b/indra/llvfs/lldir_win32.cpp @@ -249,7 +249,7 @@ std::string LLDir_Win32::getCurPath() } -BOOL LLDir_Win32::fileExists(const std::string &filename) const +bool LLDir_Win32::fileExists(const std::string &filename) const { llstat stat_data; // Check the age of the file diff --git a/indra/llvfs/lldir_win32.h b/indra/llvfs/lldir_win32.h index 62fb4713ab..450efaf9da 100644 --- a/indra/llvfs/lldir_win32.h +++ b/indra/llvfs/lldir_win32.h @@ -44,7 +44,7 @@ public: /*virtual*/ std::string getCurPath(); /*virtual*/ U32 countFilesInDir(const std::string &dirname, const std::string &mask); - /*virtual*/ BOOL fileExists(const std::string &filename) const; + /*virtual*/ bool fileExists(const std::string &filename) const; /*virtual*/ std::string getLLPluginLauncher(); /*virtual*/ std::string getLLPluginFilename(std::string base_name); diff --git a/indra/newview/tests/lldir_stub.cpp b/indra/newview/tests/lldir_stub.cpp index 18cf4e7419..88f063f009 100644 --- a/indra/newview/tests/lldir_stub.cpp +++ b/indra/newview/tests/lldir_stub.cpp @@ -48,7 +48,7 @@ public: /*virtual*/ U32 countFilesInDir(const std::string &dirname, const std::string &mask) { return 42; } /*virtual*/ BOOL getNextFileInDir(const std::string &dirname, const std::string &mask, std::string &fname, BOOL wrap) { fname = fname + "_NEXT"; return false; } /*virtual*/ void getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname) { fname = "RANDOM_FILE"; } - /*virtual*/ BOOL fileExists(const std::string &filename) const { return false; } + /*virtual*/ bool fileExists(const std::string &filename) const { return false; } }; LLDir_stub gDirUtil; diff --git a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp index 7c016fecf9..f0d3fcbd07 100644 --- a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp +++ b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp @@ -63,7 +63,7 @@ class LLDir_Mock : public LLDir const std::string &mask, std::string &fname) {} std::string getCurPath() { return ""; } - BOOL fileExists(const std::string &filename) const { return false; } + bool fileExists(const std::string &filename) const { return false; } std::string getLLPluginLauncher() { return ""; } std::string getLLPluginFilename(std::string base_name) { return ""; } -- cgit v1.2.3 From acc53a1c226999878d26b0b4bd58ac8df3256c06 Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Tue, 27 Nov 2012 14:27:52 -0800 Subject: New VFS objects included in every bite! --- indra/llvfs/llvfs_objc.h | 43 ++++++++++++++++++++++ indra/llvfs/llvfs_objc.mm | 93 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 indra/llvfs/llvfs_objc.h create mode 100644 indra/llvfs/llvfs_objc.mm diff --git a/indra/llvfs/llvfs_objc.h b/indra/llvfs/llvfs_objc.h new file mode 100644 index 0000000000..90101eb2e9 --- /dev/null +++ b/indra/llvfs/llvfs_objc.h @@ -0,0 +1,43 @@ +/** + * @file llvfs_objc.h + * @brief Definition of directory utilities class for Mac OS X + * + * $LicenseInfo:firstyear=2000&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#if !LL_DARWIN +#error This header must not be included when compiling for any target other than Mac OS. Consider including lldir.h instead. +#endif // !LL_DARWIN + +#ifndef LL_LLVFS_OBJC_H +#define LL_LLVFS_OBJC_H + +#include + +std::string* getSystemTempFolder(); +std::string* getSystemCacheFolder(); +std::string* getSystemApplicationSupportFolder(); +std::string* getSystemResourceFolder(); +std::string* getSystemExecutableFolder(); + + +#endif LL_LLVFS_OBJC_H diff --git a/indra/llvfs/llvfs_objc.mm b/indra/llvfs/llvfs_objc.mm new file mode 100644 index 0000000000..4d7cd3a93e --- /dev/null +++ b/indra/llvfs/llvfs_objc.mm @@ -0,0 +1,93 @@ +/** + * @file llvfs_objc.cpp + * @brief Cocoa implementation of directory utilities for Mac OS X + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ +#if LL_DARWIN + +//WARNING: This file CANNOT use standard linden includes due to conflicts between definitions of BOOL + +#include "llvfs_objc.h" +#import + +std::string* getSystemTempFolder() +{ + NSString * tempDir = NSTemporaryDirectory(); + if (tempDir == nil) + tempDir = @"/tmp"; + return ( new std::string([tempDir UTF8String]) ); +} + +//findSystemDirectory scoped exclusively to this file. +std::string* findSystemDirectory(NSSearchPathDirectory searchPathDirectory, + NSSearchPathDomainMask domainMask) +{ + std::string *result; + NSString *path = nil; + + // Search for the path + NSArray* paths = NSSearchPathForDirectoriesInDomains(searchPathDirectory, + domainMask, + YES); + if ([paths count]) + { + NSString *bundleName = + [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"]; + path = [[paths objectAtIndex:0] stringByAppendingPathComponent:bundleName]; + + //SPATTERS HACK: Always attempt to create directory, ignore errors. + NSError *error = nil; + + [[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:&error]; + + + result = new std::string([path UTF8String]); + } + return result; +} + +std::string* getSystemExecutableFolder() +{ + NSString *bundlePath = [[NSBundle mainBundle] executablePath]; + return (new std::string([bundlePath UTF8String])); +} + +std::string* getSystemResourceFolder() +{ + NSString *bundlePath = [[NSBundle mainBundle] resourcePath]; + return (new std::string([bundlePath UTF8String])); +} + +std::string* getSystemCacheFolder() +{ + return findSystemDirectory (NSCachesDirectory, + NSUserDomainMask); +} + +std::string* getSystemApplicationSupportFolder() +{ + return findSystemDirectory (NSApplicationSupportDirectory, + NSUserDomainMask); +} + +#endif // LL_DARWIN -- cgit v1.2.3 From 1149c94c5b5008f6c076ce4b072f54e48c4783ae Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Thu, 29 Nov 2012 23:33:31 -0800 Subject: Crashlogger only runs when it comes from teamcity so I must checkin debug and wait. What fun. --- indra/llcrashlogger/llcrashlogger.cpp | 2 +- indra/llvfs/lldir.cpp | 3 ++- indra/mac_crash_logger/mac_crash_logger.cpp | 8 -------- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp index d6dcde4b9f..7ecb34eaf6 100644 --- a/indra/llcrashlogger/llcrashlogger.cpp +++ b/indra/llcrashlogger/llcrashlogger.cpp @@ -384,7 +384,7 @@ bool LLCrashLogger::init() LLCurl::initClass(false); // We assume that all the logs we're looking for reside on the current drive - gDirUtilp->initAppDirs("SecondLife"); + gDirUtilp->initAppDirs("com.secondlife.indra.viewer"); LLError::initForApplication(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "")); diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp index 32d081d552..bd5ce4acac 100644 --- a/indra/llvfs/lldir.cpp +++ b/indra/llvfs/lldir.cpp @@ -431,6 +431,7 @@ std::string LLDir::getExpandedFilename(ELLPath location, const std::string& subd llassert(0); } + llinfos << "SPATTERS got " << prefix << " for location " << location << llendl; std::string filename = in_filename; if (!subdir2.empty()) { @@ -471,7 +472,7 @@ std::string LLDir::getExpandedFilename(ELLPath location, const std::string& subd expanded_filename.assign(""); } - //llinfos << "*** EXPANDED FILENAME: <" << expanded_filename << ">" << llendl; + llinfos << "*** EXPANDED FILENAME: <" << expanded_filename << ">" << llendl; return expanded_filename; } diff --git a/indra/mac_crash_logger/mac_crash_logger.cpp b/indra/mac_crash_logger/mac_crash_logger.cpp index 4d0a7af27f..5e6806c08e 100644 --- a/indra/mac_crash_logger/mac_crash_logger.cpp +++ b/indra/mac_crash_logger/mac_crash_logger.cpp @@ -34,12 +34,6 @@ int main(int argc, char **argv) { - std::ofstream outputFile; - outputFile.open("/tmp/aura.txt"); - outputFile << "TEstiNG" << std::endl; - llinfos << "SPATTERS ASDFSDFSDF" << llendl; - llinfos << "Starting crash reporter." << llendl; - LLCrashLoggerMac app; app.parseCommandOptions(argc, argv); @@ -57,7 +51,5 @@ int main(int argc, char **argv) app.cleanup(); llinfos << "Crash reporter finished normally." << llendl; - outputFile.close(); - return 0; } -- cgit v1.2.3 From 9085dc3e84b66e9f3802ebaf23dedb5891c39065 Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Fri, 30 Nov 2012 00:46:02 -0800 Subject: Removed logging. --- indra/llvfs/lldir.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp index bd5ce4acac..32d081d552 100644 --- a/indra/llvfs/lldir.cpp +++ b/indra/llvfs/lldir.cpp @@ -431,7 +431,6 @@ std::string LLDir::getExpandedFilename(ELLPath location, const std::string& subd llassert(0); } - llinfos << "SPATTERS got " << prefix << " for location " << location << llendl; std::string filename = in_filename; if (!subdir2.empty()) { @@ -472,7 +471,7 @@ std::string LLDir::getExpandedFilename(ELLPath location, const std::string& subd expanded_filename.assign(""); } - llinfos << "*** EXPANDED FILENAME: <" << expanded_filename << ">" << llendl; + //llinfos << "*** EXPANDED FILENAME: <" << expanded_filename << ">" << llendl; return expanded_filename; } -- cgit v1.2.3 From e21275f3562950ae5e5acde8e6f4f631d6c7f1b9 Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Thu, 6 Dec 2012 21:00:37 -0800 Subject: Fixed several minor issues with validation. --- indra/mac_updater/AutoUpdater.nib/classes.nib | 4 -- indra/mac_updater/AutoUpdater.nib/info.nib | 14 ------- indra/mac_updater/AutoUpdater.nib/objects.xib | 56 --------------------------- indra/mac_updater/MacUpdaterAppDelegate.mm | 5 +-- indra/mac_updater/mac_updater.cpp | 30 +++++++------- indra/mac_updater/mac_updater.h | 4 +- 6 files changed, 19 insertions(+), 94 deletions(-) delete mode 100644 indra/mac_updater/AutoUpdater.nib/classes.nib delete mode 100644 indra/mac_updater/AutoUpdater.nib/info.nib delete mode 100644 indra/mac_updater/AutoUpdater.nib/objects.xib diff --git a/indra/mac_updater/AutoUpdater.nib/classes.nib b/indra/mac_updater/AutoUpdater.nib/classes.nib deleted file mode 100644 index ea58db1189..0000000000 --- a/indra/mac_updater/AutoUpdater.nib/classes.nib +++ /dev/null @@ -1,4 +0,0 @@ -{ -IBClasses = (); -IBVersion = 1; -} diff --git a/indra/mac_updater/AutoUpdater.nib/info.nib b/indra/mac_updater/AutoUpdater.nib/info.nib deleted file mode 100644 index a49a92385b..0000000000 --- a/indra/mac_updater/AutoUpdater.nib/info.nib +++ /dev/null @@ -1,14 +0,0 @@ - - - - - IBDocumentLocation - 103 138 356 240 0 0 1280 1002 - IBFramework Version - 362.0 - IBSystem Version - 7D24 - targetFramework - IBCarbonFramework - - diff --git a/indra/mac_updater/AutoUpdater.nib/objects.xib b/indra/mac_updater/AutoUpdater.nib/objects.xib deleted file mode 100644 index 310411b711..0000000000 --- a/indra/mac_updater/AutoUpdater.nib/objects.xib +++ /dev/null @@ -1,56 +0,0 @@ - - - IBCarbonFramework - - NSApplication - - - - 405 222 533 663 - Second Life Updater - - 0 0 128 441 - - - 20 20 44 421 - what - Initializing… - - - 88 351 108 421 - Cancel - not! - 2 - - - 51 19 70 422 - prog - 50 - - - - FALSE - 2 - 3 - 7 - - - - - - - - - - - - - - - File's Owner - - Updater - - - 194 - diff --git a/indra/mac_updater/MacUpdaterAppDelegate.mm b/indra/mac_updater/MacUpdaterAppDelegate.mm index 80206cb508..179946a238 100644 --- a/indra/mac_updater/MacUpdaterAppDelegate.mm +++ b/indra/mac_updater/MacUpdaterAppDelegate.mm @@ -133,8 +133,6 @@ bool mkTempDir(boost::filesystem::path& temp_dir) std::string* temp_str = NSToString(tempDir); *temp_str += std::string("SecondLifeUpdate_XXXXXX"); - std::cout << "tempDir is " << temp_str << std::endl; - char temp[PATH_MAX] = ""; /* Flawfinder: ignore */ strncpy(temp, temp_str->c_str(), temp_str->length()); @@ -224,7 +222,6 @@ std::string* getUserTrashFolder() bool isFSRefViewerBundle(const std::string& targetURL) { bool result = false; - NSString *fullPath = [NSString stringWithCString:targetURL.c_str() encoding:[NSString defaultCStringEncoding]]; NSBundle *targetBundle = [NSBundle bundleWithPath:fullPath]; @@ -233,7 +230,7 @@ bool isFSRefViewerBundle(const std::string& targetURL) encoding:[NSString defaultCStringEncoding]]; result = [targetBundleStr isEqualToString:sourceBundleStr]; - + if(!result) { std::cout << "Target bundle ID mismatch." << std::endl; diff --git a/indra/mac_updater/mac_updater.cpp b/indra/mac_updater/mac_updater.cpp index 379e69e033..47fc16769c 100644 --- a/indra/mac_updater/mac_updater.cpp +++ b/indra/mac_updater/mac_updater.cpp @@ -135,11 +135,11 @@ void LLMacUpdater::doUpdate() } //SPATTERS TODO this should be moved to lldir_mac.cpp -const std::string LLMacUpdater::walkParents( unsigned int depth, const std::string& childpath ) +const std::string LLMacUpdater::walkParents( signed int depth, const std::string& childpath ) { boost::filesystem::path fullpath(childpath.c_str()); - while (depth >= 0 && fullpath.has_parent_path()) + while (depth > 0 && fullpath.has_parent_path()) { fullpath = boost::filesystem::path(fullpath.parent_path()); --depth; @@ -187,10 +187,10 @@ bool LLMacUpdater::isApplication(const std::string& app_str) bool LLMacUpdater::findAppBundleOnDiskImage(const boost::filesystem::path& dir_path, boost::filesystem::path& path_found) { - if ( !exists( dir_path ) ) return false; + if ( !boost::filesystem::exists( dir_path ) ) return false; boost::filesystem::directory_iterator end_itr; - + for ( boost::filesystem::directory_iterator itr( dir_path ); itr != end_itr; ++itr ) @@ -247,11 +247,9 @@ bool LLMacUpdater::getViewerDir(boost::filesystem::path &app_dir) app_dir = boost::filesystem::path(app_dir_str); - std::string app_str(app_dir.string()); - //Check to see that the directory's name ends in .app Lame but it's the best thing we have to go on. //If it's not there, we're going to default to /Applications/VIEWERNAME - if (!isApplication(app_str)) + if (!isApplication(app_dir_str)) { llinfos << "Target search failed, defaulting to /Applications/" << *mProductName << ".app." << llendl; std::string newpath = std::string("/Applications/") + mProductName->c_str(); @@ -505,7 +503,6 @@ void* LLMacUpdater::updatethreadproc(void*) bool replacingTarget = false; - boost::filesystem::path install_dir; boost::filesystem::path app_dir; boost::filesystem::path temp_dir; boost::filesystem::path mount_dir; @@ -516,7 +513,6 @@ void* LLMacUpdater::updatethreadproc(void*) try { replacingTarget = getViewerDir( app_dir ); - install_dir = app_dir.parent_path(); if (!mkTempDir(temp_dir)) { @@ -524,24 +520,27 @@ void* LLMacUpdater::updatethreadproc(void*) } //In case the dir doesn't exist, try to create it. If create fails, verify it exists. - if (! boost::filesystem::create_directory(install_dir)) + if (! boost::filesystem::create_directory(app_dir)) { - if(isFSRefViewerBundle(install_dir.parent_path().string())) + if(isFSRefViewerBundle(app_dir.string())) { // This is the bundle we're looking for. replacingTarget = true; } + else + { + throw 0; + } } - if ( !verifyDirectory(&install_dir, true) ) + if ( !verifyDirectory(&app_dir, true) ) { // We're so hosed. llinfos << "Applications directory not found, giving up." << llendl; throw 0; } - // Skip downloading the file if the dmg was passed on the command line. std::string dmgName; @@ -553,7 +552,10 @@ void* LLMacUpdater::updatethreadproc(void*) dmgName = dmg_path.string(); std::string* dmgPath = new std::string(dmg_path.parent_path().string()); - if (!isDirWritable(*dmgPath)) throw 0; + if ( !boost::filesystem::exists( dmg_path.parent_path() ) ) { + llinfos << "Path " << *dmgPath << " is not writeable. Aborting." << llendl; + throw 0; + } chdir(dmgPath->c_str()); } else { diff --git a/indra/mac_updater/mac_updater.h b/indra/mac_updater/mac_updater.h index 756f46f996..758d2750aa 100644 --- a/indra/mac_updater/mac_updater.h +++ b/indra/mac_updater/mac_updater.h @@ -34,7 +34,7 @@ extern bool gCancelled; extern bool gFailure; void *updatethreadproc(void*); -std::string* walkParents( unsigned int depth, std::string* childpath ); +std::string* walkParents( signed int depth, std::string* childpath ); std::string* getUserTrashFolder(); void setProgress(int cur, int max); @@ -55,7 +55,7 @@ class LLMacUpdater public: LLMacUpdater(); void doUpdate(); - const std::string walkParents( unsigned int depth, const std::string& childpath ); + const std::string walkParents( signed int depth, const std::string& childpath ); bool isApplication(const std::string& app_str); void filterFile(const char* filename); -- cgit v1.2.3 From 2b3bcdbcbb8359220e0026b84b8521197ad0cf50 Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Thu, 6 Dec 2012 21:01:39 -0800 Subject: Added compiled AutoUpdater.nib made from new AutoUpdater.xib --- indra/mac_updater/AutoUpdater.nib | Bin 0 -> 5251 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100755 indra/mac_updater/AutoUpdater.nib diff --git a/indra/mac_updater/AutoUpdater.nib b/indra/mac_updater/AutoUpdater.nib new file mode 100755 index 0000000000..03883e2b86 Binary files /dev/null and b/indra/mac_updater/AutoUpdater.nib differ -- cgit v1.2.3 From 53ea30af06f94b5462fada7c4bfea3122b50ff95 Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Tue, 11 Dec 2012 06:56:14 -0800 Subject: Interim debug checkin to test from teamcity --- indra/llcrashlogger/llcrashlogger.cpp | 13 ++++++++++++- indra/llvfs/llvfs_objc.mm | 9 +++++---- indra/mac_crash_logger/llcrashloggermac.cpp | 11 ++++++++++- indra/mac_crash_logger/mac_crash_logger.cpp | 17 +++++++++++++++++ 4 files changed, 44 insertions(+), 6 deletions(-) diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp index 7ecb34eaf6..008b0e04b5 100644 --- a/indra/llcrashlogger/llcrashlogger.cpp +++ b/indra/llcrashlogger/llcrashlogger.cpp @@ -339,6 +339,10 @@ bool LLCrashLogger::runCrashLogPost(std::string host, LLSD data, std::string msg bool LLCrashLogger::sendCrashLogs() { + std::ofstream wlog; + wlog.open("/Users/samantha/crashlogging2.txt"); + wlog << "SPATTERS sendingCrashLogs.!\n"; + gatherFiles(); LLSD post_data; @@ -350,6 +354,7 @@ bool LLCrashLogger::sendCrashLogs() "SecondLifeCrashReport"); std::string report_file = dump_path + ".log"; + wlog << "SPATTERS looking in dump_path " << dump_path << " report_file " << report_file << "\n"; std::ofstream out_file(report_file.c_str()); LLSDSerialize::toPrettyXML(post_data, out_file); out_file.close(); @@ -359,14 +364,18 @@ bool LLCrashLogger::sendCrashLogs() //*TODO: Translate if(mCrashHost != "") { + wlog << "SPATTERS sending to MAIN host " << mCrashHost << "\n"; sent = runCrashLogPost(mCrashHost, post_data, std::string("Sending to server"), 3, 5); } if(!sent) { + wlog << "SPATTERS sending to MAIN host " << mAltCrashHost << "\n"; sent = runCrashLogPost(mAltCrashHost, post_data, std::string("Sending to alternate server"), 3, 5); } + wlog.close(); + mSentCrashLogs = sent; return true; @@ -384,7 +393,7 @@ bool LLCrashLogger::init() LLCurl::initClass(false); // We assume that all the logs we're looking for reside on the current drive - gDirUtilp->initAppDirs("com.secondlife.indra.viewer"); + gDirUtilp->initAppDirs("SecondLife"); LLError::initForApplication(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "")); @@ -394,6 +403,7 @@ bool LLCrashLogger::init() // Rename current log file to ".old" std::string old_log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "crashreport.log.old"); std::string log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "crashreport.log"); + llinfos << "SPATTERS moving " << log_file << " to " << old_log_file <prime(gAPRPoolp); LLHTTPClient::setPump(*gServicePump); diff --git a/indra/llvfs/llvfs_objc.mm b/indra/llvfs/llvfs_objc.mm index 4d7cd3a93e..61cfad99d6 100644 --- a/indra/llvfs/llvfs_objc.mm +++ b/indra/llvfs/llvfs_objc.mm @@ -51,10 +51,10 @@ std::string* findSystemDirectory(NSSearchPathDirectory searchPathDirectory, YES); if ([paths count]) { - NSString *bundleName = - [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"]; - path = [[paths objectAtIndex:0] stringByAppendingPathComponent:bundleName]; - + //NSString *bundleName = @"SecondLife"; + //[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"]; + //path = [[paths objectAtIndex:0] stringByAppendingPathComponent:bundleName]; + path = [paths objectAtIndex:0]; //SPATTERS HACK: Always attempt to create directory, ignore errors. NSError *error = nil; @@ -88,6 +88,7 @@ std::string* getSystemApplicationSupportFolder() { return findSystemDirectory (NSApplicationSupportDirectory, NSUserDomainMask); + } #endif // LL_DARWIN diff --git a/indra/mac_crash_logger/llcrashloggermac.cpp b/indra/mac_crash_logger/llcrashloggermac.cpp index 5d22b60136..64064d9cee 100644 --- a/indra/mac_crash_logger/llcrashloggermac.cpp +++ b/indra/mac_crash_logger/llcrashloggermac.cpp @@ -66,22 +66,31 @@ void LLCrashLoggerMac::gatherPlatformSpecificFiles() bool LLCrashLoggerMac::mainLoop() { + std::ofstream wlog; + wlog.open("/Users/samantha/crashlogging1.txt"); + wlog << "SPATTERS mainloop.!\n"; + if (mCrashBehavior == CRASH_BEHAVIOR_ALWAYS_SEND) { + wlog << "sending\n"; gSendReport = true; } if(gRememberChoice) { + wlog << "momento\n"; if(gSendReport) saveCrashBehaviorSetting(CRASH_BEHAVIOR_ALWAYS_SEND); else saveCrashBehaviorSetting(CRASH_BEHAVIOR_NEVER_SEND); } if(gSendReport) { + wlog << "Send report!"; setUserText(gUserNotes); sendCrashLogs(); - } + } + + wlog.close(); return true; } diff --git a/indra/mac_crash_logger/mac_crash_logger.cpp b/indra/mac_crash_logger/mac_crash_logger.cpp index 5e6806c08e..0d4f2855c7 100644 --- a/indra/mac_crash_logger/mac_crash_logger.cpp +++ b/indra/mac_crash_logger/mac_crash_logger.cpp @@ -34,22 +34,39 @@ int main(int argc, char **argv) { + std::ofstream wlog; + wlog.open("/Users/samantha/crashlogging.txt"); + wlog << "SPATTERS starting crash reporter.!\n"; LLCrashLoggerMac app; + wlog << "SPATTERS created app instance.!\n"; + for (int x=0;x Date: Tue, 11 Dec 2012 07:40:26 -0800 Subject: Crash reporter fixed, debugging removed. --- indra/llcrashlogger/llcrashlogger.cpp | 13 +------------ indra/llvfs/llvfs_objc.mm | 3 --- indra/mac_crash_logger/llcrashloggermac.cpp | 11 +---------- indra/mac_crash_logger/mac_crash_logger.cpp | 17 ----------------- 4 files changed, 2 insertions(+), 42 deletions(-) diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp index 008b0e04b5..34e25a8a71 100644 --- a/indra/llcrashlogger/llcrashlogger.cpp +++ b/indra/llcrashlogger/llcrashlogger.cpp @@ -339,10 +339,6 @@ bool LLCrashLogger::runCrashLogPost(std::string host, LLSD data, std::string msg bool LLCrashLogger::sendCrashLogs() { - std::ofstream wlog; - wlog.open("/Users/samantha/crashlogging2.txt"); - wlog << "SPATTERS sendingCrashLogs.!\n"; - gatherFiles(); LLSD post_data; @@ -354,7 +350,6 @@ bool LLCrashLogger::sendCrashLogs() "SecondLifeCrashReport"); std::string report_file = dump_path + ".log"; - wlog << "SPATTERS looking in dump_path " << dump_path << " report_file " << report_file << "\n"; std::ofstream out_file(report_file.c_str()); LLSDSerialize::toPrettyXML(post_data, out_file); out_file.close(); @@ -364,18 +359,14 @@ bool LLCrashLogger::sendCrashLogs() //*TODO: Translate if(mCrashHost != "") { - wlog << "SPATTERS sending to MAIN host " << mCrashHost << "\n"; sent = runCrashLogPost(mCrashHost, post_data, std::string("Sending to server"), 3, 5); } if(!sent) { - wlog << "SPATTERS sending to MAIN host " << mAltCrashHost << "\n"; sent = runCrashLogPost(mAltCrashHost, post_data, std::string("Sending to alternate server"), 3, 5); } - - wlog.close(); - + mSentCrashLogs = sent; return true; @@ -403,7 +394,6 @@ bool LLCrashLogger::init() // Rename current log file to ".old" std::string old_log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "crashreport.log.old"); std::string log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "crashreport.log"); - llinfos << "SPATTERS moving " << log_file << " to " << old_log_file <prime(gAPRPoolp); LLHTTPClient::setPump(*gServicePump); diff --git a/indra/llvfs/llvfs_objc.mm b/indra/llvfs/llvfs_objc.mm index 61cfad99d6..16cfefda26 100644 --- a/indra/llvfs/llvfs_objc.mm +++ b/indra/llvfs/llvfs_objc.mm @@ -51,9 +51,6 @@ std::string* findSystemDirectory(NSSearchPathDirectory searchPathDirectory, YES); if ([paths count]) { - //NSString *bundleName = @"SecondLife"; - //[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"]; - //path = [[paths objectAtIndex:0] stringByAppendingPathComponent:bundleName]; path = [paths objectAtIndex:0]; //SPATTERS HACK: Always attempt to create directory, ignore errors. NSError *error = nil; diff --git a/indra/mac_crash_logger/llcrashloggermac.cpp b/indra/mac_crash_logger/llcrashloggermac.cpp index 64064d9cee..c5f660ca6e 100644 --- a/indra/mac_crash_logger/llcrashloggermac.cpp +++ b/indra/mac_crash_logger/llcrashloggermac.cpp @@ -66,32 +66,23 @@ void LLCrashLoggerMac::gatherPlatformSpecificFiles() bool LLCrashLoggerMac::mainLoop() { - std::ofstream wlog; - wlog.open("/Users/samantha/crashlogging1.txt"); - wlog << "SPATTERS mainloop.!\n"; - if (mCrashBehavior == CRASH_BEHAVIOR_ALWAYS_SEND) { - wlog << "sending\n"; gSendReport = true; } if(gRememberChoice) { - wlog << "momento\n"; if(gSendReport) saveCrashBehaviorSetting(CRASH_BEHAVIOR_ALWAYS_SEND); else saveCrashBehaviorSetting(CRASH_BEHAVIOR_NEVER_SEND); } if(gSendReport) { - wlog << "Send report!"; setUserText(gUserNotes); sendCrashLogs(); } - - wlog.close(); - + return true; } diff --git a/indra/mac_crash_logger/mac_crash_logger.cpp b/indra/mac_crash_logger/mac_crash_logger.cpp index 0d4f2855c7..6add74556f 100644 --- a/indra/mac_crash_logger/mac_crash_logger.cpp +++ b/indra/mac_crash_logger/mac_crash_logger.cpp @@ -29,44 +29,27 @@ #include "indra_constants.h" #include -#include - int main(int argc, char **argv) { - std::ofstream wlog; - wlog.open("/Users/samantha/crashlogging.txt"); - wlog << "SPATTERS starting crash reporter.!\n"; LLCrashLoggerMac app; - wlog << "SPATTERS created app instance.!\n"; - for (int x=0;x Date: Wed, 12 Dec 2012 09:22:14 -0500 Subject: MAINT-2051: Implement replacement of an existing autoreplace list --- indra/newview/llautoreplace.cpp | 40 ++++++++++++++++++++++++++ indra/newview/llautoreplace.h | 3 ++ indra/newview/llfloaterautoreplacesettings.cpp | 17 +++++++++-- 3 files changed, 57 insertions(+), 3 deletions(-) diff --git a/indra/newview/llautoreplace.cpp b/indra/newview/llautoreplace.cpp index 0f1ce2bcd0..d71cf290d6 100644 --- a/indra/newview/llautoreplace.cpp +++ b/indra/newview/llautoreplace.cpp @@ -536,6 +536,46 @@ LLAutoReplaceSettings::AddListResult LLAutoReplaceSettings::addList(const LLSD& return result; } +LLAutoReplaceSettings::AddListResult LLAutoReplaceSettings::replaceList(const LLSD& newList) +{ + AddListResult result = AddListInvalidList; + if ( listIsValid( newList ) ) + { + std::string listName = newList[AUTOREPLACE_LIST_NAME].asString(); + bool listFound = false; + S32 search_index; + LLSD targetList; + // The following is working around the fact that LLSD arrays containing maps also seem to have undefined entries... see LLSD-30 + for ( search_index = 0, targetList = mLists[0]; + !listFound && search_index < mLists.size(); + search_index += 1, targetList = mLists[search_index] + ) + { + if ( targetList.isMap() ) + { + if ( listNameMatches( targetList, listName) ) + { + LL_DEBUGS("AutoReplace")<<"list to replace found at "< Date: Wed, 12 Dec 2012 10:53:13 -0500 Subject: MAINT-2082: fix deletion of an autoreplace list --- indra/newview/llfloaterautoreplacesettings.cpp | 29 +++++++++++++++++++------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/indra/newview/llfloaterautoreplacesettings.cpp b/indra/newview/llfloaterautoreplacesettings.cpp index 5dcdded744..6e56e929df 100644 --- a/indra/newview/llfloaterautoreplacesettings.cpp +++ b/indra/newview/llfloaterautoreplacesettings.cpp @@ -514,14 +514,27 @@ bool LLFloaterAutoReplaceSettings::callbackListNameConflict(const LLSD& notifica void LLFloaterAutoReplaceSettings::onDeleteList() { - std::string listName= mListNames->getFirstSelected()->getColumn(0)->getValue().asString(); - mSettings.removeReplacementList(listName); // remove from the copy of settings - mReplacementsList->deleteSelectedItems(); // remove from the scrolling list - - mSelectedListName.clear(); - updateListNames(); - updateListNamesControls(); - updateReplacementsList(); + std::string listName = mListNames->getSelectedValue().asString(); + if ( ! listName.empty() ) + { + if ( mSettings.removeReplacementList(listName) ) + { + LL_INFOS("AutoReplace")<<"deleted list '"<deleteSelectedItems(); // remove from the scrolling list + mSelectedListName.clear(); + updateListNames(); + updateListNamesControls(); + updateReplacementsList(); + } + else + { + LL_WARNS("AutoReplace")<<"failed to delete list '"< Date: Thu, 13 Dec 2012 08:44:22 -0800 Subject: MAINT-1995 Names of banned and allowed residents are not shown in Access tab of the About Land dialog Code by Richard, reviewed by merov and kelly --- indra/llui/llscrolllistctrl.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 3e0653e9a4..5b0894b064 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -580,6 +580,15 @@ BOOL LLScrollListCtrl::addItem( LLScrollListItem* item, EAddPosition pos, BOOL r addColumn(col_params); } + S32 num_cols = item->getNumColumns(); + S32 i = 0; + for (LLScrollListCell* cell = item->getColumn(i); i < num_cols; cell = item->getColumn(++i)) + { + if (i >= (S32)mColumnsIndexed.size()) break; + + cell->setWidth(mColumnsIndexed[i]->getWidth()); + } + updateLineHeightInsert(item); updateLayout(); -- cgit v1.2.3 From 00ebeaba581c5ed1686458502091ac8a30c75237 Mon Sep 17 00:00:00 2001 From: Kelly Washington Date: Thu, 13 Dec 2012 11:14:16 -0800 Subject: Fix line endings. --- indra/llui/llscrolllistctrl.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 5b0894b064..d332aa933e 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -580,13 +580,13 @@ BOOL LLScrollListCtrl::addItem( LLScrollListItem* item, EAddPosition pos, BOOL r addColumn(col_params); } - S32 num_cols = item->getNumColumns(); - S32 i = 0; - for (LLScrollListCell* cell = item->getColumn(i); i < num_cols; cell = item->getColumn(++i)) - { - if (i >= (S32)mColumnsIndexed.size()) break; - - cell->setWidth(mColumnsIndexed[i]->getWidth()); + S32 num_cols = item->getNumColumns(); + S32 i = 0; + for (LLScrollListCell* cell = item->getColumn(i); i < num_cols; cell = item->getColumn(++i)) + { + if (i >= (S32)mColumnsIndexed.size()) break; + + cell->setWidth(mColumnsIndexed[i]->getWidth()); } updateLineHeightInsert(item); -- cgit v1.2.3 From ef07952d0d165cad1a3d5b3ee3ad981b6a6a4832 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 13 Dec 2012 14:37:50 -0500 Subject: tag merge of DRTVWR-265 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index dbfbbf538c..9a1dbf4e95 100755 --- a/.hgtags +++ b/.hgtags @@ -370,3 +370,4 @@ ab0aa2f6ba22b52fed30a2337197f589156edc75 DRTVWR-253 44e764a6ac9e672a4f3bce821a4b6a218590c374 DRTVWR-258 c23d734065ed593b2413385aecd8366d8e0ee96b DRTVWR-257 452ce96d4046dc05a3ecaecc203e2cc8ddd72e76 DRTVWR-259 +daca610d840625b5bebb966a57cb49581852c417 DRTVWR-265 -- cgit v1.2.3 From 874917106b5dadce90211e64d2526e173b3ecbf3 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 13 Dec 2012 14:38:18 -0500 Subject: Removed tag 3.4.3-release --- .hgtags | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.hgtags b/.hgtags index c57c2cd58d..9422bb2376 100755 --- a/.hgtags +++ b/.hgtags @@ -373,3 +373,5 @@ c23d734065ed593b2413385aecd8366d8e0ee96b DRTVWR-257 452ce96d4046dc05a3ecaecc203e2cc8ddd72e76 DRTVWR-259 5cba5f39d0a81d659f24ebc4b5efd025a39e3db1 3.4.3-release daca610d840625b5bebb966a57cb49581852c417 DRTVWR-265 +5cba5f39d0a81d659f24ebc4b5efd025a39e3db1 3.4.3-release +0000000000000000000000000000000000000000 3.4.3-release -- cgit v1.2.3 From 35ef55b63fb7ee9a0e1b3cf257d27654c2cfd66d Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 13 Dec 2012 14:57:36 -0500 Subject: tag merge of DRTVWR-266 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index dbfbbf538c..15b09f7619 100755 --- a/.hgtags +++ b/.hgtags @@ -370,3 +370,4 @@ ab0aa2f6ba22b52fed30a2337197f589156edc75 DRTVWR-253 44e764a6ac9e672a4f3bce821a4b6a218590c374 DRTVWR-258 c23d734065ed593b2413385aecd8366d8e0ee96b DRTVWR-257 452ce96d4046dc05a3ecaecc203e2cc8ddd72e76 DRTVWR-259 +9afbdc4e24cc04feacfb2b7a10b78a64f780901a DRTVWR-266 -- cgit v1.2.3 From 2282d6b11a2d46387514c9a352b4ccae5fa6e5d9 Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Thu, 13 Dec 2012 12:24:17 -0800 Subject: Fixed whitespace issues for merge. --- indra/llplugin/slplugin/slplugin-objc.h | 4 +++- indra/mac_crash_logger/CMakeLists.txt | 6 +++--- indra/mac_crash_logger/llcrashloggermacdelegate.h | 4 +++- indra/mac_updater/CMakeLists.txt | 8 ++++---- indra/mac_updater/MacUpdaterAppDelegate.h | 4 +++- indra/mac_updater/mac_updater.h | 4 +++- 6 files changed, 19 insertions(+), 11 deletions(-) diff --git a/indra/llplugin/slplugin/slplugin-objc.h b/indra/llplugin/slplugin/slplugin-objc.h index 9a8e81873f..f2c2b3239c 100644 --- a/indra/llplugin/slplugin/slplugin-objc.h +++ b/indra/llplugin/slplugin/slplugin-objc.h @@ -48,4 +48,6 @@ public: NSWindow* mFrontWindow; NSWindow* mPluginWindow; int mHackState; -}; \ No newline at end of file +}; + + diff --git a/indra/mac_crash_logger/CMakeLists.txt b/indra/mac_crash_logger/CMakeLists.txt index 87ee344598..3906a3bb8c 100644 --- a/indra/mac_crash_logger/CMakeLists.txt +++ b/indra/mac_crash_logger/CMakeLists.txt @@ -23,14 +23,14 @@ include_directories( set(mac_crash_logger_SOURCE_FILES mac_crash_logger.cpp llcrashloggermac.cpp - llcrashloggermacdelegate.mm - ) + llcrashloggermacdelegate.mm + ) set(mac_crash_logger_HEADER_FILES CMakeLists.txt llcrashloggermac.h - llcrashloggermacdelegate.h + llcrashloggermacdelegate.h ) set_source_files_properties(${mac_crash_logger_HEADER_FILES} diff --git a/indra/mac_crash_logger/llcrashloggermacdelegate.h b/indra/mac_crash_logger/llcrashloggermacdelegate.h index 8557b77e7d..c998a8efe2 100644 --- a/indra/mac_crash_logger/llcrashloggermacdelegate.h +++ b/indra/mac_crash_logger/llcrashloggermacdelegate.h @@ -47,4 +47,6 @@ @property (assign) IBOutlet NSWindow *window; @end -*/ \ No newline at end of file +*/ + + diff --git a/indra/mac_updater/CMakeLists.txt b/indra/mac_updater/CMakeLists.txt index 4f39e941a1..7382e912bf 100644 --- a/indra/mac_updater/CMakeLists.txt +++ b/indra/mac_updater/CMakeLists.txt @@ -19,13 +19,13 @@ include_directories( set(mac_updater_SOURCE_FILES main.m - MacUpdaterAppDelegate.mm - mac_updater.cpp + MacUpdaterAppDelegate.mm + mac_updater.cpp ) set(mac_updater_HEADER_FILES MacUpdaterAppDelegate.h - mac_updater.h + mac_updater.h CMakeLists.txt ) @@ -63,7 +63,7 @@ target_link_libraries(mac-updater ${OPENSSL_LIBRARIES} ${CRYPTO_LIBRARIES} ${COCOA_LIBRARIES} - ${BOOST_FILESYSTEM_LIBRARY} + ${BOOST_FILESYSTEM_LIBRARY} ${IOKIT_LIBRARY} ${CURL_LIBRARIES} ${CARES_LIBRARIES} diff --git a/indra/mac_updater/MacUpdaterAppDelegate.h b/indra/mac_updater/MacUpdaterAppDelegate.h index ba5744b398..c051214bb8 100644 --- a/indra/mac_updater/MacUpdaterAppDelegate.h +++ b/indra/mac_updater/MacUpdaterAppDelegate.h @@ -55,4 +55,6 @@ LLMacUpdater mUpdater; @end -#endif //LL_MAC_UPDATE_DELEGATE_H \ No newline at end of file +#endif //LL_MAC_UPDATE_DELEGATE_H + + diff --git a/indra/mac_updater/mac_updater.h b/indra/mac_updater/mac_updater.h index 758d2750aa..f65b481cb6 100644 --- a/indra/mac_updater/mac_updater.h +++ b/indra/mac_updater/mac_updater.h @@ -86,4 +86,6 @@ public: static LLMacUpdater *sInstance; }; -#endif \ No newline at end of file +#endif + + -- cgit v1.2.3 From e2bd5f7a9d8f5b967954c3e0bc97e662f7149af7 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 13 Dec 2012 15:29:01 -0500 Subject: tag merge of DRTVWR-244 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 11c544b106..a1df0f9fc4 100755 --- a/.hgtags +++ b/.hgtags @@ -372,3 +372,4 @@ ab0aa2f6ba22b52fed30a2337197f589156edc75 DRTVWR-253 c23d734065ed593b2413385aecd8366d8e0ee96b DRTVWR-257 452ce96d4046dc05a3ecaecc203e2cc8ddd72e76 DRTVWR-259 5cba5f39d0a81d659f24ebc4b5efd025a39e3db1 3.4.3-release +18c5f76ac07937e0b64bb874edba0d60a28cec56 DRTVWR-244 -- cgit v1.2.3 From b7ac7a0797e29b0f55a6f28f99bb1b3750b4bde3 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 13 Dec 2012 17:12:31 -0500 Subject: tag merge of DRTVWR-267 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index dbfbbf538c..ccb8007d88 100755 --- a/.hgtags +++ b/.hgtags @@ -370,3 +370,4 @@ ab0aa2f6ba22b52fed30a2337197f589156edc75 DRTVWR-253 44e764a6ac9e672a4f3bce821a4b6a218590c374 DRTVWR-258 c23d734065ed593b2413385aecd8366d8e0ee96b DRTVWR-257 452ce96d4046dc05a3ecaecc203e2cc8ddd72e76 DRTVWR-259 +73280db02501f5ad041fc18b1eba68e73a81996c DRTVWR-267 -- cgit v1.2.3 From 9f1b484817840cc8f185090f2e8b7bdee441ea7a Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 13 Dec 2012 18:10:21 -0500 Subject: Added tag 3.4.3-beta3 for changeset 870e2d79e006 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index b034f71591..b384f9d5cc 100755 --- a/.hgtags +++ b/.hgtags @@ -374,3 +374,4 @@ c23d734065ed593b2413385aecd8366d8e0ee96b DRTVWR-257 daca610d840625b5bebb966a57cb49581852c417 DRTVWR-265 9afbdc4e24cc04feacfb2b7a10b78a64f780901a DRTVWR-266 73280db02501f5ad041fc18b1eba68e73a81996c DRTVWR-267 +870e2d79e0063fda87187f17bbc2747766733194 3.4.3-beta3 -- cgit v1.2.3 From 3a72577f397a3cd3ebcb2d3e80000716bf0befec Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Thu, 13 Dec 2012 18:27:32 -0800 Subject: Fixes from Oz's merge. --- indra/llvfs/lldir_mac.cpp | 4 +++- indra/mac_updater/mac_updater.cpp | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/indra/llvfs/lldir_mac.cpp b/indra/llvfs/lldir_mac.cpp index 75b3d56ebc..c5041d434c 100644 --- a/indra/llvfs/lldir_mac.cpp +++ b/indra/llvfs/lldir_mac.cpp @@ -77,7 +77,9 @@ LLDir_Mac::LLDir_Mac() boost::filesystem::path executablepath(*executablepathstr); - mExecutableFilename = executablepath.filename(); +# ifndef BOOST_SYSTEM_NO_DEPRECATED +#endif + mExecutableFilename = executablepath.filename().string(); mExecutableDir = executablepath.parent_path().string(); // mAppRODataDir diff --git a/indra/mac_updater/mac_updater.cpp b/indra/mac_updater/mac_updater.cpp index 34d2b07438..fc9565d63d 100644 --- a/indra/mac_updater/mac_updater.cpp +++ b/indra/mac_updater/mac_updater.cpp @@ -197,7 +197,7 @@ bool LLMacUpdater::findAppBundleOnDiskImage(const boost::filesystem::path& dir_p { if ( boost::filesystem::is_directory(itr->status()) ) { - std::string dir_name = itr->string(); + std::string dir_name = itr->path().string(); if ( isApplication(dir_name) ) { if(isFSRefViewerBundle(dir_name)) @@ -399,7 +399,7 @@ bool LLMacUpdater::moveApplication (const boost::filesystem::path& app_dir, //Grab filename from installdir append to tempdir move set aside_dir to moved path. std::string install_str = app_dir.parent_path().string(); std::string temp_str = temp_dir.string(); - std::string app_str = app_dir.filename(); + std::string app_str = app_dir.filename().string(); aside_dir = boost::filesystem::path( boost::filesystem::operator/(temp_dir,app_str) ); std::cout << "Attempting to move " << app_dir.string() << " to " << aside_dir.string() << std::endl; -- cgit v1.2.3 From d3293be2fe5b2bb04310ad1efc3801f724589654 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 14 Dec 2012 12:56:58 -0500 Subject: tag merge of DRTVWR-224 --- .hgtags | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.hgtags b/.hgtags index 740260312a..a016310d16 100755 --- a/.hgtags +++ b/.hgtags @@ -380,3 +380,5 @@ c23d734065ed593b2413385aecd8366d8e0ee96b DRTVWR-257 5cba5f39d0a81d659f24ebc4b5efd025a39e3db1 3.4.3-release 9aa1aa9f1fe13c194695a0b8f0af298296241dc2 DRTVWR-260 18c5f76ac07937e0b64bb874edba0d60a28cec56 DRTVWR-244 +dd23d4da3bcb2ffda58569e759feb7c119982973 DRTVWR-224 +12655fb818f3b0b08a4638d0cda1ad1f01e5f52f DRTVWR-224 -- cgit v1.2.3 From 5c9dd94e197a5db10fdf794ec1632e5586053df8 Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Fri, 14 Dec 2012 21:41:02 +0000 Subject: BOOL vs bool FIGHT --- indra/llvfs/tests/lldir_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llvfs/tests/lldir_test.cpp b/indra/llvfs/tests/lldir_test.cpp index 323f876c12..3cff622a4b 100644 --- a/indra/llvfs/tests/lldir_test.cpp +++ b/indra/llvfs/tests/lldir_test.cpp @@ -134,7 +134,7 @@ struct LLDir_Dummy: public LLDir return 0; } - virtual BOOL fileExists(const std::string& pathname) const + virtual bool fileExists(const std::string& pathname) const { // Record fileExists() calls so we can check whether caching is // working right. Certain LLDir calls should be able to make decisions -- cgit v1.2.3 From c1db961ab9b7aa9c0dd43cadf850b7527b77e95b Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Sun, 16 Dec 2012 17:45:55 -0800 Subject: Fixed small one-time memory leaks. --- indra/llvfs/llvfs_objc.mm | 23 ++++++++++++++++++++--- indra/mac_updater/MacUpdaterAppDelegate.mm | 22 ++++++++++++++++++++-- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/indra/llvfs/llvfs_objc.mm b/indra/llvfs/llvfs_objc.mm index 16cfefda26..4f9e2f81e9 100644 --- a/indra/llvfs/llvfs_objc.mm +++ b/indra/llvfs/llvfs_objc.mm @@ -32,16 +32,22 @@ std::string* getSystemTempFolder() { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSString * tempDir = NSTemporaryDirectory(); if (tempDir == nil) tempDir = @"/tmp"; - return ( new std::string([tempDir UTF8String]) ); + std::string *result = ( new std::string([tempDir UTF8String]) ); + [pool release]; + + return result; } //findSystemDirectory scoped exclusively to this file. std::string* findSystemDirectory(NSSearchPathDirectory searchPathDirectory, NSSearchPathDomainMask domainMask) { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + std::string *result; NSString *path = nil; @@ -60,19 +66,30 @@ std::string* findSystemDirectory(NSSearchPathDirectory searchPathDirectory, result = new std::string([path UTF8String]); } + [pool release]; return result; } std::string* getSystemExecutableFolder() { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + NSString *bundlePath = [[NSBundle mainBundle] executablePath]; - return (new std::string([bundlePath UTF8String])); + std::string *result = (new std::string([bundlePath UTF8String])); + [pool release]; + + return result; } std::string* getSystemResourceFolder() { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + NSString *bundlePath = [[NSBundle mainBundle] resourcePath]; - return (new std::string([bundlePath UTF8String])); + std::string *result = (new std::string([bundlePath UTF8String])); + [pool release]; + + return result; } std::string* getSystemCacheFolder() diff --git a/indra/mac_updater/MacUpdaterAppDelegate.mm b/indra/mac_updater/MacUpdaterAppDelegate.mm index 3ddf8f9274..b6f95eef7e 100644 --- a/indra/mac_updater/MacUpdaterAppDelegate.mm +++ b/indra/mac_updater/MacUpdaterAppDelegate.mm @@ -126,6 +126,8 @@ void sendProgress(int cur, int max, const std::string str) bool copyDir(const std::string& src_dir, const std::string& dest_dir) { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + NSString* file = [NSString stringWithCString:src_dir.c_str() encoding:[NSString defaultCStringEncoding]]; NSString* toParent = [NSString stringWithCString:dest_dir.c_str() @@ -137,6 +139,8 @@ bool copyDir(const std::string& src_dir, const std::string& dest_dir) if (!result) { NSLog(@"Error during copy: %@", [error localizedDescription]); } + [pool release]; + return result; } @@ -178,26 +182,38 @@ bool copyDir(const std::string& src_dir, const std::string& dest_dir) bool isDirWritable(const std::string& dir_name) { - + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + NSString *fullPath = [NSString stringWithCString:dir_name.c_str() encoding:[NSString defaultCStringEncoding]]; NSFileManager *fm = [NSFileManager defaultManager]; bool result = [fm isWritableFileAtPath:fullPath]; + [pool release]; return result; } std::string* getUserTrashFolder() { + std::string *result; + + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + NSString *trash_str=[NSHomeDirectory() stringByAppendingPathComponent:@".Trash"]; - return NSToString( trash_str ); + + result = NSToString( trash_str ); + + [pool release]; + return result; } bool isFSRefViewerBundle(const std::string& targetURL) { bool result = false; + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + NSString *fullPath = [NSString stringWithCString:targetURL.c_str() encoding:[NSString defaultCStringEncoding]]; NSBundle *targetBundle = [NSBundle bundleWithPath:fullPath]; @@ -212,6 +228,8 @@ bool isFSRefViewerBundle(const std::string& targetURL) std::cout << "Target bundle ID mismatch." << std::endl; } + [pool release]; + return result; } -- cgit v1.2.3 From 7a6b073dcafc55838f9f1f82bd5f940052ec7690 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 17 Dec 2012 10:14:32 -0500 Subject: tag merge of DRTVWR-244 --- .hgtags | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.hgtags b/.hgtags index 740260312a..41cc6d7b03 100755 --- a/.hgtags +++ b/.hgtags @@ -380,3 +380,5 @@ c23d734065ed593b2413385aecd8366d8e0ee96b DRTVWR-257 5cba5f39d0a81d659f24ebc4b5efd025a39e3db1 3.4.3-release 9aa1aa9f1fe13c194695a0b8f0af298296241dc2 DRTVWR-260 18c5f76ac07937e0b64bb874edba0d60a28cec56 DRTVWR-244 +18c5f76ac07937e0b64bb874edba0d60a28cec56 DRTVWR-244 +84fbaf2d4141bd161731430e760949dc787ca206 DRTVWR-244 -- cgit v1.2.3 From 2206653f2ebf8090782732506e9e669afc275520 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 17 Dec 2012 14:44:26 -0500 Subject: Added tag 3.4.3-release for changeset 0a2ca6546b49 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index b384f9d5cc..9c6d3a9450 100755 --- a/.hgtags +++ b/.hgtags @@ -375,3 +375,4 @@ daca610d840625b5bebb966a57cb49581852c417 DRTVWR-265 9afbdc4e24cc04feacfb2b7a10b78a64f780901a DRTVWR-266 73280db02501f5ad041fc18b1eba68e73a81996c DRTVWR-267 870e2d79e0063fda87187f17bbc2747766733194 3.4.3-beta3 +0a2ca6546b499239afeb66d17b2fadbcdbe36ab1 3.4.3-release -- cgit v1.2.3 From 769336a72ef819b45bfabcb8608f70c9396f58ae Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 17 Dec 2012 14:46:39 -0500 Subject: Added tag 3.4.4-beta1 for changeset 083d2d36b5bb --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 8dce366b7a..b1bd7cf117 100755 --- a/.hgtags +++ b/.hgtags @@ -384,3 +384,4 @@ daca610d840625b5bebb966a57cb49581852c417 DRTVWR-265 870e2d79e0063fda87187f17bbc2747766733194 3.4.3-beta3 0a2ca6546b499239afeb66d17b2fadbcdbe36ab1 3.4.3-release 84fbaf2d4141bd161731430e760949dc787ca206 DRTVWR-244 +083d2d36b5bb1c54fc3dd7caac0e7ac381a9cef0 3.4.4-beta1 -- cgit v1.2.3 From 1be900c1531e44c32fd8fd64e79aeb44e53a3c43 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 17 Dec 2012 14:54:12 -0500 Subject: increment version to 3.4.5 --- indra/llcommon/llversionviewer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index 8585af0a29..39f9de3bc2 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -29,7 +29,7 @@ const S32 LL_VERSION_MAJOR = 3; const S32 LL_VERSION_MINOR = 4; -const S32 LL_VERSION_PATCH = 4; +const S32 LL_VERSION_PATCH = 5; const S32 LL_VERSION_BUILD = 0; const char * const LL_CHANNEL = "Second Life Developer"; -- cgit v1.2.3 From 6710b60b104a119b91ffc468424f8c8fe25ef2da Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Mon, 17 Dec 2012 13:17:00 -0800 Subject: MAINT-2134: Removing llassert() calls that were causing problems with the Debug and RelWithDebInfo builds. Also, reworked the rest of the methods to only apply in cases where the class instance has been initialized. --- .../llmenuoptionpathfindingrebakenavmesh.cpp | 82 ++++++++++++---------- 1 file changed, 44 insertions(+), 38 deletions(-) diff --git a/indra/newview/llmenuoptionpathfindingrebakenavmesh.cpp b/indra/newview/llmenuoptionpathfindingrebakenavmesh.cpp index dd5f1ea689..bf4f4bceed 100644 --- a/indra/newview/llmenuoptionpathfindingrebakenavmesh.cpp +++ b/indra/newview/llmenuoptionpathfindingrebakenavmesh.cpp @@ -54,23 +54,21 @@ LLMenuOptionPathfindingRebakeNavmesh::LLMenuOptionPathfindingRebakeNavmesh() LLMenuOptionPathfindingRebakeNavmesh::~LLMenuOptionPathfindingRebakeNavmesh() { - if (mRebakeNavMeshMode == kRebakeNavMesh_RequestSent) - { - LL_WARNS("navmeshRebaking") << "During destruction of the LLMenuOptionPathfindingRebakeNavmesh " - << "singleton, the mode indicates that a request has been sent for which a response has yet " - << "to be received. This could contribute to a crash on exit." << LL_ENDL; - } - - llassert(!mIsInitialized); if (mIsInitialized) { + if (mRebakeNavMeshMode == kRebakeNavMesh_RequestSent) + { + LL_WARNS("navmeshRebaking") << "During destruction of the LLMenuOptionPathfindingRebakeNavmesh " + << "singleton, the mode indicates that a request has been sent for which a response has yet " + << "to be received. This could contribute to a crash on exit." << LL_ENDL; + } + quit(); } } void LLMenuOptionPathfindingRebakeNavmesh::initialize() { - llassert(!mIsInitialized); if (!mIsInitialized) { mIsInitialized = true; @@ -94,7 +92,6 @@ void LLMenuOptionPathfindingRebakeNavmesh::initialize() void LLMenuOptionPathfindingRebakeNavmesh::quit() { - llassert(mIsInitialized); if (mIsInitialized) { if (mNavMeshSlot.connected()) @@ -175,51 +172,60 @@ void LLMenuOptionPathfindingRebakeNavmesh::handleAgentState(BOOL pCanRebakeRegio void LLMenuOptionPathfindingRebakeNavmesh::handleRebakeNavMeshResponse(bool pResponseStatus) { llassert(mIsInitialized); - if (getMode() == kRebakeNavMesh_RequestSent) + if (mIsInitialized) { - setMode(pResponseStatus ? kRebakeNavMesh_InProgress : kRebakeNavMesh_Default); - } + if (getMode() == kRebakeNavMesh_RequestSent) + { + setMode(pResponseStatus ? kRebakeNavMesh_InProgress : kRebakeNavMesh_Default); + } - if (!pResponseStatus) - { - LLNotificationsUtil::add("PathfindingCannotRebakeNavmesh"); + if (!pResponseStatus) + { + LLNotificationsUtil::add("PathfindingCannotRebakeNavmesh"); + } } } void LLMenuOptionPathfindingRebakeNavmesh::handleNavMeshStatus(const LLPathfindingNavMeshStatus &pNavMeshStatus) { llassert(mIsInitialized); - ERebakeNavMeshMode rebakeNavMeshMode = kRebakeNavMesh_Default; - if (pNavMeshStatus.isValid()) + if (mIsInitialized) { - switch (pNavMeshStatus.getStatus()) + ERebakeNavMeshMode rebakeNavMeshMode = kRebakeNavMesh_Default; + if (pNavMeshStatus.isValid()) { - case LLPathfindingNavMeshStatus::kPending : - case LLPathfindingNavMeshStatus::kRepending : - rebakeNavMeshMode = kRebakeNavMesh_Available; - break; - case LLPathfindingNavMeshStatus::kBuilding : - rebakeNavMeshMode = kRebakeNavMesh_InProgress; - break; - case LLPathfindingNavMeshStatus::kComplete : - rebakeNavMeshMode = kRebakeNavMesh_NotAvailable; - break; - default : - rebakeNavMeshMode = kRebakeNavMesh_Default; - llassert(0); - break; + switch (pNavMeshStatus.getStatus()) + { + case LLPathfindingNavMeshStatus::kPending : + case LLPathfindingNavMeshStatus::kRepending : + rebakeNavMeshMode = kRebakeNavMesh_Available; + break; + case LLPathfindingNavMeshStatus::kBuilding : + rebakeNavMeshMode = kRebakeNavMesh_InProgress; + break; + case LLPathfindingNavMeshStatus::kComplete : + rebakeNavMeshMode = kRebakeNavMesh_NotAvailable; + break; + default : + rebakeNavMeshMode = kRebakeNavMesh_Default; + llassert(0); + break; + } } - } - setMode(rebakeNavMeshMode); + setMode(rebakeNavMeshMode); + } } void LLMenuOptionPathfindingRebakeNavmesh::handleRegionBoundaryCrossed() { llassert(mIsInitialized); - createNavMeshStatusListenerForCurrentRegion(); - mCanRebakeRegion = FALSE; - LLPathfindingManager::getInstance()->requestGetAgentState(); + if (mIsInitialized) + { + createNavMeshStatusListenerForCurrentRegion(); + mCanRebakeRegion = FALSE; + LLPathfindingManager::getInstance()->requestGetAgentState(); + } } void LLMenuOptionPathfindingRebakeNavmesh::createNavMeshStatusListenerForCurrentRegion() -- cgit v1.2.3 From 00d6b1913430058add7d593bd6be790702f37ea4 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 18 Dec 2012 10:32:19 -0500 Subject: tag merge of DRTVWR-268 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index b1bd7cf117..57895358e6 100755 --- a/.hgtags +++ b/.hgtags @@ -385,3 +385,4 @@ daca610d840625b5bebb966a57cb49581852c417 DRTVWR-265 0a2ca6546b499239afeb66d17b2fadbcdbe36ab1 3.4.3-release 84fbaf2d4141bd161731430e760949dc787ca206 DRTVWR-244 083d2d36b5bb1c54fc3dd7caac0e7ac381a9cef0 3.4.4-beta1 +391a8c74cec7275c5d26c85ad108d4782a3e3dd9 DRTVWR-268 -- cgit v1.2.3 From f08c5d95ac3f7461fc4accdbf880bd02b811fddc Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 18 Dec 2012 14:20:06 -0500 Subject: MAINT-1986: patch DEV-50942 fix (rev 28828ba0f0be) from server-trunk. --- indra/llcommon/lluuid.cpp | 27 ++++++++++++++++++++------- indra/llcommon/lluuid.h | 3 +++ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp index db8c9c85ab..3926a00b03 100644 --- a/indra/llcommon/lluuid.cpp +++ b/indra/llcommon/lluuid.cpp @@ -44,10 +44,16 @@ #include "llmd5.h" #include "llstring.h" #include "lltimer.h" +#include "llthread.h" const LLUUID LLUUID::null; const LLTransactionID LLTransactionID::tnull; +// static +LLMutex * LLUUID::mMutex = NULL; + + + /* NOT DONE YET!!! @@ -734,6 +740,7 @@ void LLUUID::getCurrentTime(uuid_time_t *timestamp) getSystemTime(&time_last); uuids_this_tick = uuids_per_tick; init = TRUE; + mMutex = new LLMutex(NULL); } uuid_time_t time_now = {0,0}; @@ -785,6 +792,7 @@ void LLUUID::generate() #endif if (!has_init) { + has_init = 1; if (getNodeID(node_id) <= 0) { get_random_bytes(node_id, 6); @@ -806,18 +814,24 @@ void LLUUID::generate() #else clock_seq = (U16)ll_rand(65536); #endif - has_init = 1; } // get current time getCurrentTime(×tamp); + U16 our_clock_seq = clock_seq; - // if clock went backward change clockseq - if (cmpTime(×tamp, &time_last) == -1) { + // if clock hasn't changed or went backward, change clockseq + if (cmpTime(×tamp, &time_last) != 1) + { + LLMutexLock lock(mMutex); clock_seq = (clock_seq + 1) & 0x3FFF; - if (clock_seq == 0) clock_seq++; + if (clock_seq == 0) + clock_seq++; + our_clock_seq = clock_seq; // Ensure we're using a different clock_seq value from previous time } + time_last = timestamp; + memcpy(mData+10, node_id, 6); /* Flawfinder: ignore */ U32 tmp; tmp = timestamp.low; @@ -839,7 +853,8 @@ void LLUUID::generate() tmp >>= 8; mData[6] = (unsigned char) tmp; - tmp = clock_seq; + tmp = our_clock_seq; + mData[9] = (unsigned char) tmp; tmp >>= 8; mData[8] = (unsigned char) tmp; @@ -849,8 +864,6 @@ void LLUUID::generate() md5_uuid.update(mData,16); md5_uuid.finalize(); md5_uuid.raw_digest(mData); - - time_last = timestamp; } void LLUUID::generate(const std::string& hash_string) diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h index 0b9e7d0cd0..7889828c85 100644 --- a/indra/llcommon/lluuid.h +++ b/indra/llcommon/lluuid.h @@ -31,6 +31,8 @@ #include "stdtypes.h" #include "llpreprocessor.h" +class LLMutex; + const S32 UUID_BYTES = 16; const S32 UUID_WORDS = 4; const S32 UUID_STR_LENGTH = 37; // actually wrong, should be 36 and use size below @@ -118,6 +120,7 @@ public: static BOOL validate(const std::string& in_string); // Validate that the UUID string is legal. static const LLUUID null; + static LLMutex * mMutex; static U32 getRandomSeed(); static S32 getNodeID(unsigned char * node_id); -- cgit v1.2.3 From 5c334bdc5b6746eb6a2f1a9bb6b85098acb49bc9 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 18 Dec 2012 16:09:31 -0500 Subject: MAINT-1986: patch OPSDEV-111 fix (rev 9346b73d6843) from server-trunk --- indra/llcommon/lluuid.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp index 3926a00b03..0aaa50d231 100644 --- a/indra/llcommon/lluuid.cpp +++ b/indra/llcommon/lluuid.cpp @@ -877,8 +877,14 @@ U32 LLUUID::getRandomSeed() static unsigned char seed[16]; /* Flawfinder: ignore */ getNodeID(&seed[0]); - seed[6]='\0'; - seed[7]='\0'; + + // Incorporate the pid into the seed to prevent + // processes that start on the same host at the same + // time from generating the same seed. + pid_t pid = LLApp::getPid(); + + seed[6]=(unsigned char)(pid >> 8); + seed[7]=(unsigned char)(pid); getSystemTime((uuid_time_t *)(&seed[8])); LLMD5 md5_seed; -- cgit v1.2.3 From a9a21ecffa52ad0e53000c4fdd94569c50022889 Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Tue, 18 Dec 2012 13:30:21 -0800 Subject: Switched mkTempDir back to using apple standard tempdir behavior instead of /tmp --- indra/mac_updater/MacUpdaterAppDelegate.mm | 23 +++++++++++++++++++++++ indra/mac_updater/mac_updater.cpp | 14 -------------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/indra/mac_updater/MacUpdaterAppDelegate.mm b/indra/mac_updater/MacUpdaterAppDelegate.mm index b6f95eef7e..4457419a94 100644 --- a/indra/mac_updater/MacUpdaterAppDelegate.mm +++ b/indra/mac_updater/MacUpdaterAppDelegate.mm @@ -124,6 +124,29 @@ void sendProgress(int cur, int max, const std::string str) setProgressText(str); } +bool mkTempDir(boost::filesystem::path& temp_dir) +{ + NSString * tempDir = NSTemporaryDirectory(); + if (tempDir == nil) + tempDir = @"/tmp/"; + + std::string* temp_str = NSToString(tempDir); + *temp_str += std::string("SecondLifeUpdate_XXXXXX"); + + std::cout << "tempDir is " << temp_str << std::endl; + + char temp[PATH_MAX] = ""; /* Flawfinder: ignore */ + strncpy(temp, temp_str->c_str(), temp_str->length()); + + if(mkdtemp(temp) == NULL) + { + return false; + } + + temp_dir = boost::filesystem::path(temp); + + return true; +} bool copyDir(const std::string& src_dir, const std::string& dest_dir) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; diff --git a/indra/mac_updater/mac_updater.cpp b/indra/mac_updater/mac_updater.cpp index fc9565d63d..bc9fec3558 100644 --- a/indra/mac_updater/mac_updater.cpp +++ b/indra/mac_updater/mac_updater.cpp @@ -494,20 +494,6 @@ bool LLMacUpdater::doInstall(const boost::filesystem::path& app_dir, return true; } -bool mkTempDir(boost::filesystem::path& temp_dir) -{ - char temp_str[PATH_MAX] = "/tmp/SecondLifeUpdate_XXXXXX"; - - if(mkdtemp(temp_str) == NULL) - { - return false; - } - - temp_dir = boost::filesystem::path(temp_str); - - return true; -} - void* LLMacUpdater::updatethreadproc(void*) { char tempDir[PATH_MAX] = ""; /* Flawfinder: ignore */ -- cgit v1.2.3 From 8a2c30b388a190e24d9c886fdaa9a7b83179f194 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 19 Dec 2012 06:40:44 -0500 Subject: MAINT-1986: in TeamCity, do not reload saved hashmap_test data. Rev b7fd7c95c571 allows a developer to debug a failure in hashmap_test 1. Once the test fails, rerunning that test will replay the same failure to try to permit debugging it. But that behavior is extremely undesirable under TeamCity! In a TeamCity run, don't even check for saved data file. --- indra/test/lluuidhashmap_tut.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/indra/test/lluuidhashmap_tut.cpp b/indra/test/lluuidhashmap_tut.cpp index 408bc3faf1..9712a613f4 100644 --- a/indra/test/lluuidhashmap_tut.cpp +++ b/indra/test/lluuidhashmap_tut.cpp @@ -117,9 +117,10 @@ namespace tut std::string savefile(gDirUtilp->add(tempdir, "lluuidhashmap_tut.save.txt")); const int numElementsToCheck = 32*256*32; std::vector idList; - if (gDirUtilp->fileExists(savefile)) + if ((! getenv("TEAMCITY_PROJECT_NAME")) && gDirUtilp->fileExists(savefile)) { - // We have saved data from a previous failed run. Reload that data. + // This is not a TeamCity build, and we have saved data from a + // previous failed run. Reload that data. std::ifstream inf(savefile.c_str()); if (! inf.is_open()) { @@ -139,8 +140,8 @@ namespace tut } else { - // savefile does not exist (normal case): regenerate idList from - // scratch. + // This is a TeamCity build, or (normal case) savefile does not + // exist: regenerate idList from scratch. for (int i = 0; i < numElementsToCheck; ++i) { LLUUID id; -- cgit v1.2.3 From 0ed83541bff20d5bcefc374d702cf62b85727bba Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 19 Dec 2012 09:41:59 -0500 Subject: upgrade boost build to use public build of icu4c --- autobuild.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index fb0de9feb2..7e6192af6e 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -186,9 +186,9 @@ archive hash - 610d3c3790b39d44b45ed1e471f7b34d + ac37d0038c91b0672fa31a02731f0eac url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-boost/rev/267115/arch/Darwin/installer/boost-1.52.0-darwin-20121117.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-boost/rev/268347/arch/Darwin/installer/boost-1.52.0-darwin-20121218.tar.bz2 name darwin @@ -198,9 +198,9 @@ archive hash - 86b9108ab71bd6551365d1706e2fb178 + 146ed8a8c2ef8ab3f0a6c4f214fc5c22 url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-boost/rev/267115/arch/Linux/installer/boost-1.52.0-linux-20121117.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-boost/rev/268347/arch/Linux/installer/boost-1.52.0-linux-20121218.tar.bz2 name linux @@ -210,9 +210,9 @@ archive hash - a3bf306ebd14036a93f7894f898a862c + 3ea60f17d986b7e8a3351298734bdca4 url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-boost/rev/267115/arch/CYGWIN/installer/boost-1.52.0-windows-20121117.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-boost/rev/268347/arch/CYGWIN/installer/boost-1.52.0-windows-20121218.tar.bz2 name windows -- cgit v1.2.3 From 1c7f19c8658b869bc0c3ebd06ad9129ef11dbd20 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 19 Dec 2012 09:45:28 -0500 Subject: change to use lindenlab repo for havok source, with new license --- autobuild.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index 7e6192af6e..017427278e 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -918,9 +918,9 @@ archive hash - efaf5cb3e861d44518eb03f4c406f03c + e6feee3b452c2f70ce8558e30d6bc10a url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/falcon_3p-havok-source/rev/261536/arch/Darwin/installer/havok_source-2012.1-darwin-20120710.tar.bz2 + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/lindenlab_3p-havok-source/rev/268409/arch/Darwin/installer/havok_source-2012.1-darwin-20121219.tar.bz2 name darwin @@ -930,9 +930,9 @@ archive hash - 50037fff3fd3356a073cdae88348c9ab + 0c0d2058ba48446e274d6595d1d8063e url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/falcon_3p-havok-source/rev/261536/arch/Linux/installer/havok_source-2012.1-linux-20120711.tar.bz2 + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/lindenlab_3p-havok-source/rev/268409/arch/Linux/installer/havok_source-2012.1-linux-20121219.tar.bz2 name linux @@ -942,9 +942,9 @@ archive hash - cd6638f5a03469654615730c16889a60 + 88391b6e08d473506d406ca6f3e88cfb url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/falcon_3p-havok-source/rev/261536/arch/CYGWIN/installer/havok_source-2012.1-windows-20120710.tar.bz2 + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/lindenlab_3p-havok-source/rev/268409/arch/CYGWIN/installer/havok_source-2012.1-windows-20121219.tar.bz2 name windows -- cgit v1.2.3 From 213be712b26119832ccc9f04a17c9013792b5044 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 19 Dec 2012 16:52:25 -0500 Subject: tag merge of DRTVWR-270 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 740260312a..84457d6f0e 100755 --- a/.hgtags +++ b/.hgtags @@ -380,3 +380,4 @@ c23d734065ed593b2413385aecd8366d8e0ee96b DRTVWR-257 5cba5f39d0a81d659f24ebc4b5efd025a39e3db1 3.4.3-release 9aa1aa9f1fe13c194695a0b8f0af298296241dc2 DRTVWR-260 18c5f76ac07937e0b64bb874edba0d60a28cec56 DRTVWR-244 +b634dec987c16e8c9c938e11e52591d9ead8fa9b DRTVWR-270 -- cgit v1.2.3 From d8ac1c0f2f05e85a9a85547c0529734fc7d52d30 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 19 Dec 2012 17:49:16 -0500 Subject: Added tag 3.4.4-beta2 for changeset cd39255bd233 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index a00dde6543..0be54334a3 100755 --- a/.hgtags +++ b/.hgtags @@ -386,3 +386,4 @@ b418be80903520c492e1173f3afbc4021cad5d07 DRTVWR-255 18c5f76ac07937e0b64bb874edba0d60a28cec56 DRTVWR-244 083d2d36b5bb1c54fc3dd7caac0e7ac381a9cef0 3.4.4-beta1 b634dec987c16e8c9c938e11e52591d9ead8fa9b DRTVWR-270 +cd39255bd23330fd30c04105f2811e941d8524fe 3.4.4-beta2 -- cgit v1.2.3 From 867d00c68781b3a0fa8124f8040cede62e176442 Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Thu, 20 Dec 2012 09:16:16 -0800 Subject: There goes a month of work --- indra/mac_updater/AutoUpdater.nib | Bin 5251 -> 0 bytes indra/mac_updater/AutoUpdater.xib | 520 ----------------------------- indra/mac_updater/MacUpdater-Info.plist | 30 -- indra/mac_updater/MacUpdaterAppDelegate.h | 60 ---- indra/mac_updater/MacUpdaterAppDelegate.mm | 288 ---------------- indra/mac_updater/main.m | 34 -- 6 files changed, 932 deletions(-) delete mode 100755 indra/mac_updater/AutoUpdater.nib delete mode 100644 indra/mac_updater/AutoUpdater.xib delete mode 100644 indra/mac_updater/MacUpdater-Info.plist delete mode 100644 indra/mac_updater/MacUpdaterAppDelegate.h delete mode 100644 indra/mac_updater/MacUpdaterAppDelegate.mm delete mode 100644 indra/mac_updater/main.m diff --git a/indra/mac_updater/AutoUpdater.nib b/indra/mac_updater/AutoUpdater.nib deleted file mode 100755 index 03883e2b86..0000000000 Binary files a/indra/mac_updater/AutoUpdater.nib and /dev/null differ diff --git a/indra/mac_updater/AutoUpdater.xib b/indra/mac_updater/AutoUpdater.xib deleted file mode 100644 index b29fffba3a..0000000000 --- a/indra/mac_updater/AutoUpdater.xib +++ /dev/null @@ -1,520 +0,0 @@ - - - - 1070 - 11G63 - 2182 - 1138.51 - 569.00 - - com.apple.InterfaceBuilder.CocoaPlugin - 2182 - - - NSTextField - NSView - NSWindowTemplate - NSProgressIndicator - NSCustomObject - IBNSLayoutConstraint - NSButtonCell - NSButton - NSUserDefaultsController - NSTextFieldCell - - - com.apple.InterfaceBuilder.CocoaPlugin - - - PluginDependencyRecalculationVersion - - - - - NSObject - - - FirstResponder - - - NSApplication - - - 15 - 2 - {{196, 240}, {402, 120}} - 544735232 - Window - NSWindow - - - - - 256 - - - - 268 - {{17, 83}, {79, 17}} - - - - _NS:1505 - YES - - 68288064 - 272630784 - Initalizing... - - LucidaGrande - 13 - 1044 - - _NS:1505 - - - 6 - System - controlColor - - 3 - MC42NjY2NjY2NjY3AA - - - - 6 - System - controlTextColor - - 3 - MAA - - - - - - - 268 - {{18, 55}, {366, 20}} - - - - _NS:9 - {250, 250} - 16399 - 100 - - - - 268 - {{308, 19}, {74, 19}} - - - - _NS:9 - YES - - -2080244224 - 134217728 - Cancel - - LucidaGrande - 12 - 16 - - _NS:9 - - -2038152961 - 164 - - - 400 - 75 - - - - {402, 120} - - - - - {{0, 0}, {1680, 1028}} - {10000000000000, 10000000000000} - YES - - - MacUpdaterAppDelegate - - - YES - - - - - - - title: values - - - - - - title: values - title - values - 2 - - - 41 - - - - - - 0 - - - - - - -2 - - - File's Owner - - - -1 - - - First Responder - - - -3 - - - Application - - - 1 - - - - - - - - 2 - - - - - - - 5 - 0 - - 5 - 1 - - 20 - - 1000 - 8 - 29 - 3 - - - - - 5 - 0 - - 5 - 1 - - 20 - - 1000 - 8 - 29 - 3 - - - - - 6 - 0 - - 6 - 1 - - 20 - - 1000 - 8 - 29 - 3 - - - - - - 6 - 0 - - 6 - 1 - - 20 - - 1000 - 8 - 29 - 3 - - - - - 3 - 0 - - 3 - 1 - - 20 - - 1000 - 8 - 29 - 3 - - - - - 3 - 0 - - 4 - 1 - - 8 - - 1000 - 6 - 24 - 3 - - - - - 4 - 0 - - 4 - 1 - - 20 - - 1000 - 8 - 29 - 3 - - - - - - - 3 - - - - - - - - 4 - - - - - 8 - - - - - - 20 - - - - - 22 - - - - - - 7 - 0 - - 0 - 1 - - 74 - - 1000 - 3 - 9 - 1 - - - - - - - 23 - - - - - 31 - - - - - 32 - - - - - 35 - - - - - 36 - - - - - 37 - - - - - 38 - - - - - 39 - - - - - 40 - - - - - 42 - - - - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{357, 418}, {480, 270}} - - - - - - - - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - - - - - 42 - - - - - MacUpdaterAppDelegate - NSObject - - cancel: - id - - - cancel: - - cancel: - id - - - - NSProgressIndicator - NSTextField - NSWindow - - - - mProgressBar - NSProgressIndicator - - - mProgressText - NSTextField - - - window - NSWindow - - - - IBProjectSource - ./Classes/MacUpdaterAppDelegate.h - - - - - 0 - IBCocoaFramework - YES - 3 - YES - - diff --git a/indra/mac_updater/MacUpdater-Info.plist b/indra/mac_updater/MacUpdater-Info.plist deleted file mode 100644 index 92137095ff..0000000000 --- a/indra/mac_updater/MacUpdater-Info.plist +++ /dev/null @@ -1,30 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - mac-updater - CFBundleGetInfoString - - CFBundleIconFile - - CFBundleIdentifier - com.secondlife.indra.autoupdater - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - APPL - CFBundleShortVersionString - - CFBundleSignature - ???? - CFBundleVersion - 1.0.0 - NSMainNibFile - AutoUpdater - NSPrincipalClass - NSApplication - - diff --git a/indra/mac_updater/MacUpdaterAppDelegate.h b/indra/mac_updater/MacUpdaterAppDelegate.h deleted file mode 100644 index c051214bb8..0000000000 --- a/indra/mac_updater/MacUpdaterAppDelegate.h +++ /dev/null @@ -1,60 +0,0 @@ -/** - * @file MacUpdaterAppDelegate.h - * @brief - * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - - -#import -#include -#include "mac_updater.h" - -#ifndef LL_MAC_UPDATE_DELEGATE_H -#define LL_MAC_UPDATE_DELEGATE_H - -@interface MacUpdaterAppDelegate : NSObject -{ - IBOutlet NSProgressIndicator *mProgressBar; - IBOutlet NSTextField *mProgressText; -} -- (void)setWindow:(NSWindow *)newWindow; -- (NSWindow *)window; -- (IBAction)cancel:(id)sender; -- (void) setProgress:(int)cur max:(int) max; -- (void) setProgressText:(const std::string&)str; -- (int) parse_args:(NSArray *) args; -- (void)stopAlert; -- (void)stopAlertDidEnd:(NSAlert *)alert returnCode:(int)returnCode contextInfo:(void *)contextInfo; - - -NSWindow *_window; -bool mAnimated; -double mProgressPercentage; -@property (assign) IBOutlet NSWindow *window; -LLMacUpdater mUpdater; - -@end - -#endif //LL_MAC_UPDATE_DELEGATE_H - - diff --git a/indra/mac_updater/MacUpdaterAppDelegate.mm b/indra/mac_updater/MacUpdaterAppDelegate.mm deleted file mode 100644 index 4457419a94..0000000000 --- a/indra/mac_updater/MacUpdaterAppDelegate.mm +++ /dev/null @@ -1,288 +0,0 @@ -/** - * @file MacUpdaterAppDelegate.mm - * @brief - * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#import "MacUpdaterAppDelegate.h" -#include "llvfs_objc.h" -#include -#include - -@implementation MacUpdaterAppDelegate - -MacUpdaterAppDelegate *gWindow; -bool gCancelled = false; -bool gFailure =false; - - -//@synthesize window = _window; -- (void)setWindow:(NSWindow *)window -{ - _window = window; -} - -- (NSWindow *)window -{ - return _window; -} - -- (id)init -{ - self = [super init]; - if (self) { - - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - mAnimated = false; - mProgressPercentage = 0.0; - NSArray *arguments = [[NSProcessInfo processInfo] arguments]; - - [self parse_args:arguments]; - gWindow = self; - - mUpdater.doUpdate(); - [pool drain]; - [pool release]; - } - return self; -} - -- (void)dealloc -{ - [super dealloc]; -} - -std::string* NSToString( NSString *ns_str ) -{ - return ( new std::string([ns_str UTF8String]) ); -} - - -- (void) setProgress:(int)cur max:(int) max -{ - bool indeterminate = false; - if (max==0) - { - indeterminate = true; - } - else - { - double percentage = ((double)cur / (double)max) * 100.0; - [mProgressBar setDoubleValue:percentage]; - } - [mProgressBar setIndeterminate:indeterminate]; -} - -- (void) setProgressText:(const std::string& )str -{ - [mProgressText setStringValue:[NSString stringWithUTF8String:str.c_str()]]; -} - -void sendDone() -{ - [ [ (id) gWindow window ] close]; -} - -void sendStopAlert() -{ - [ gWindow stopAlert ]; -} - -void setProgress(int cur, int max) -{ - [ (id) gWindow setProgress:cur max:max]; -} - -void setProgressText(const std::string& str) -{ - [ (id) gWindow setProgressText:str]; -} - -void sendProgress(int cur, int max, const std::string str) -{ - setProgress(cur,max); - setProgressText(str); -} - -bool mkTempDir(boost::filesystem::path& temp_dir) -{ - NSString * tempDir = NSTemporaryDirectory(); - if (tempDir == nil) - tempDir = @"/tmp/"; - - std::string* temp_str = NSToString(tempDir); - *temp_str += std::string("SecondLifeUpdate_XXXXXX"); - - std::cout << "tempDir is " << temp_str << std::endl; - - char temp[PATH_MAX] = ""; /* Flawfinder: ignore */ - strncpy(temp, temp_str->c_str(), temp_str->length()); - - if(mkdtemp(temp) == NULL) - { - return false; - } - - temp_dir = boost::filesystem::path(temp); - - return true; -} -bool copyDir(const std::string& src_dir, const std::string& dest_dir) -{ - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - - NSString* file = [NSString stringWithCString:src_dir.c_str() - encoding:[NSString defaultCStringEncoding]]; - NSString* toParent = [NSString stringWithCString:dest_dir.c_str() - encoding:[NSString defaultCStringEncoding]]; - NSError* error = nil; - - bool result = [[NSFileManager defaultManager] copyItemAtPath: file toPath: toParent error:&error]; - - if (!result) { - NSLog(@"Error during copy: %@", [error localizedDescription]); - } - [pool release]; - - return result; -} - -- (int) parse_args:(NSArray *) args -{ - int i; - int argc = [args count]; - - mUpdater.mApplicationPath = NSToString( [args objectAtIndex:0] ); - - for( i = 1; i < argc; i++ ) - { - NSString* ns_arg = [args objectAtIndex:i]; - const char *arg = [ns_arg UTF8String]; - - if ((!strcmp(arg, "-url")) && (i < argc)) - { - mUpdater.mUpdateURL = NSToString( [args objectAtIndex:(++i)] ); - } - else if ((!strcmp(arg, "-name")) && (i < argc)) - { - mUpdater.mProductName = NSToString( [args objectAtIndex:(++i)] ); - } - else if ((!strcmp(arg, "-bundleid")) && (i < argc)) - { - mUpdater.mBundleID = NSToString( [args objectAtIndex:(++i)] ); - } - else if ((!strcmp(arg, "-dmg")) && (i < argc)) - { - mUpdater.mDmgFile = NSToString( [args objectAtIndex:(++i)] ); - } - else if ((!strcmp(arg, "-marker")) && (i < argc)) - { - mUpdater.mMarkerPath = NSToString( [args objectAtIndex:(++i)] ); - } - } - return 0; -} - -bool isDirWritable(const std::string& dir_name) -{ - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - - NSString *fullPath = [NSString stringWithCString:dir_name.c_str() - encoding:[NSString defaultCStringEncoding]]; - - NSFileManager *fm = [NSFileManager defaultManager]; - bool result = [fm isWritableFileAtPath:fullPath]; - [pool release]; - - return result; -} - -std::string* getUserTrashFolder() -{ - std::string *result; - - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - - NSString *trash_str=[NSHomeDirectory() stringByAppendingPathComponent:@".Trash"]; - - result = NSToString( trash_str ); - - [pool release]; - return result; - -} - -bool isFSRefViewerBundle(const std::string& targetURL) -{ - bool result = false; - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - - NSString *fullPath = [NSString stringWithCString:targetURL.c_str() - encoding:[NSString defaultCStringEncoding]]; - NSBundle *targetBundle = [NSBundle bundleWithPath:fullPath]; - NSString *targetBundleStr = [targetBundle bundleIdentifier]; - NSString *sourceBundleStr = [NSString stringWithCString:mUpdater.mBundleID->c_str() - encoding:[NSString defaultCStringEncoding]]; - - result = [targetBundleStr isEqualToString:sourceBundleStr]; - - if(!result) - { - std::cout << "Target bundle ID mismatch." << std::endl; - } - - [pool release]; - - return result; -} - - -- (IBAction)cancel:(id)sender -{ - gCancelled = true; - sendDone(); -} - -- (void)stopAlert -{ - NSAlert *alert = [[NSAlert alloc] init]; - [alert setAlertStyle:NSInformationalAlertStyle]; - [alert setMessageText:@"Error"]; - [alert setInformativeText:@"An error occurred while updating Second Life. Please download the latest version from www.secondlife.com."]; - - [alert beginSheetModalForWindow:_window - modalDelegate:self - - didEndSelector:@selector(stopAlertDidEnd:returnCode: - contextInfo:) - contextInfo:nil]; - } - - - (void)stopAlertDidEnd:(NSAlert *)alert - returnCode:(int)returnCode contextInfo:(void *)contextInfo -{ - [alert release]; -} - - -@end diff --git a/indra/mac_updater/main.m b/indra/mac_updater/main.m deleted file mode 100644 index aa3776a87d..0000000000 --- a/indra/mac_updater/main.m +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file main.m - * @brief - * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#import - -int main(int argc, char *argv[]) -{ - int retVal = NSApplicationMain(argc, (const char **)argv); - - return retVal; -} -- cgit v1.2.3 From e3fa3addd0f91ac4c88624be6539b253f64136d3 Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Thu, 20 Dec 2012 10:51:55 -0800 Subject: Reverted mac updater --- indra/mac_updater/AutoUpdater.nib/classes.nib | 4 + indra/mac_updater/AutoUpdater.nib/info.nib | 14 + indra/mac_updater/AutoUpdater.nib/objects.xib | 56 + indra/mac_updater/CMakeLists.txt | 22 +- indra/mac_updater/mac_updater.cpp | 1582 +++++++++++++++++-------- 5 files changed, 1167 insertions(+), 511 deletions(-) create mode 100644 indra/mac_updater/AutoUpdater.nib/classes.nib create mode 100644 indra/mac_updater/AutoUpdater.nib/info.nib create mode 100644 indra/mac_updater/AutoUpdater.nib/objects.xib diff --git a/indra/mac_updater/AutoUpdater.nib/classes.nib b/indra/mac_updater/AutoUpdater.nib/classes.nib new file mode 100644 index 0000000000..ea58db1189 --- /dev/null +++ b/indra/mac_updater/AutoUpdater.nib/classes.nib @@ -0,0 +1,4 @@ +{ +IBClasses = (); +IBVersion = 1; +} diff --git a/indra/mac_updater/AutoUpdater.nib/info.nib b/indra/mac_updater/AutoUpdater.nib/info.nib new file mode 100644 index 0000000000..a49a92385b --- /dev/null +++ b/indra/mac_updater/AutoUpdater.nib/info.nib @@ -0,0 +1,14 @@ + + + + + IBDocumentLocation + 103 138 356 240 0 0 1280 1002 + IBFramework Version + 362.0 + IBSystem Version + 7D24 + targetFramework + IBCarbonFramework + + diff --git a/indra/mac_updater/AutoUpdater.nib/objects.xib b/indra/mac_updater/AutoUpdater.nib/objects.xib new file mode 100644 index 0000000000..310411b711 --- /dev/null +++ b/indra/mac_updater/AutoUpdater.nib/objects.xib @@ -0,0 +1,56 @@ + + + IBCarbonFramework + + NSApplication + + + + 405 222 533 663 + Second Life Updater + + 0 0 128 441 + + + 20 20 44 421 + what + Initializing… + + + 88 351 108 421 + Cancel + not! + 2 + + + 51 19 70 422 + prog + 50 + + + + FALSE + 2 + 3 + 7 + + + + + + + + + + + + + + + File's Owner + + Updater + + + 194 + diff --git a/indra/mac_updater/CMakeLists.txt b/indra/mac_updater/CMakeLists.txt index 7382e912bf..00dcedecaa 100644 --- a/indra/mac_updater/CMakeLists.txt +++ b/indra/mac_updater/CMakeLists.txt @@ -18,14 +18,10 @@ include_directories( ) set(mac_updater_SOURCE_FILES - main.m - MacUpdaterAppDelegate.mm mac_updater.cpp ) set(mac_updater_HEADER_FILES - MacUpdaterAppDelegate.h - mac_updater.h CMakeLists.txt ) @@ -36,7 +32,7 @@ list(APPEND mac_updater_SOURCE_FILES ${mac_updater_HEADER_FILES}) set(mac_updater_RESOURCE_FILES - AutoUpdater.nib + AutoUpdater.nib/ ) set_source_files_properties( ${mac_updater_RESOURCE_FILES} @@ -52,19 +48,13 @@ add_executable(mac-updater set_target_properties(mac-updater PROPERTIES - MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/MacUpdater-Info.plist + MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist ) -find_library(COCOA_LIBRARY Cocoa) -find_library(IOKIT_LIBRARY IOKit) - target_link_libraries(mac-updater ${LLVFS_LIBRARIES} ${OPENSSL_LIBRARIES} ${CRYPTO_LIBRARIES} - ${COCOA_LIBRARIES} - ${BOOST_FILESYSTEM_LIBRARY} - ${IOKIT_LIBRARY} ${CURL_LIBRARIES} ${CARES_LIBRARIES} ${LLCOMMON_LIBRARIES} @@ -72,16 +62,10 @@ target_link_libraries(mac-updater add_custom_command( TARGET mac-updater POST_BUILD -# COMMAND ${CMAKE_COMMAND} -# ARGS -# -E -# copy_directory -# ${CMAKE_CURRENT_SOURCE_DIR}/AutoUpdater.nib -# ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mac-updater.app/Contents/Resources/AutoUpdater.nib COMMAND ${CMAKE_COMMAND} ARGS -E - copy + copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/AutoUpdater.nib ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mac-updater.app/Contents/Resources/AutoUpdater.nib ) diff --git a/indra/mac_updater/mac_updater.cpp b/indra/mac_updater/mac_updater.cpp index bc9fec3558..aa45c5d23f 100644 --- a/indra/mac_updater/mac_updater.cpp +++ b/indra/mac_updater/mac_updater.cpp @@ -27,8 +27,6 @@ #include "linden_common.h" #include -#include -#include #include #include @@ -36,6 +34,7 @@ #include #include +#include #include "llerror.h" #include "lltimer.h" @@ -44,552 +43,1177 @@ #include "llstring.h" +#include + #include "llerrorcontrol.h" -#include "mac_updater.h" -#include + +enum +{ + kEventClassCustom = 'Cust', + kEventCustomProgress = 'Prog', + kEventParamCustomCurValue = 'Cur ', + kEventParamCustomMaxValue = 'Max ', + kEventParamCustomText = 'Text', + kEventCustomDone = 'Done', +}; + +WindowRef gWindow = NULL; +EventHandlerRef gEventHandler = NULL; +OSStatus gFailure = noErr; +Boolean gCancelled = false; + +const char *gUpdateURL; +const char *gProductName; +const char *gBundleID; +const char *gDmgFile; +const char *gMarkerPath; + +void *updatethreadproc(void*); pthread_t updatethread; -LLMacUpdater* LLMacUpdater::sInstance = NULL; +OSStatus setProgress(int cur, int max) +{ + OSStatus err; + ControlRef progressBar = NULL; + ControlID id; + + id.signature = 'prog'; + id.id = 0; + + err = GetControlByID(gWindow, &id, &progressBar); + if(err == noErr) + { + Boolean indeterminate; + + if(max == 0) + { + indeterminate = true; + err = SetControlData(progressBar, kControlEntireControl, kControlProgressBarIndeterminateTag, sizeof(Boolean), (Ptr)&indeterminate); + } + else + { + double percentage = (double)cur / (double)max; + SetControlMinimum(progressBar, 0); + SetControlMaximum(progressBar, 100); + SetControlValue(progressBar, (SInt16)(percentage * 100)); + + indeterminate = false; + err = SetControlData(progressBar, kControlEntireControl, kControlProgressBarIndeterminateTag, sizeof(Boolean), (Ptr)&indeterminate); + + Draw1Control(progressBar); + } + } + + return(err); +} + +OSStatus setProgressText(CFStringRef text) +{ + OSStatus err; + ControlRef progressText = NULL; + ControlID id; + + id.signature = 'what'; + id.id = 0; + + err = GetControlByID(gWindow, &id, &progressText); + if(err == noErr) + { + err = SetControlData(progressText, kControlEntireControl, kControlStaticTextCFStringTag, sizeof(CFStringRef), (Ptr)&text); + Draw1Control(progressText); + } + + return(err); +} + +OSStatus sendProgress(long cur, long max, CFStringRef text = NULL) +{ + OSStatus result; + EventRef evt; + + result = CreateEvent( + NULL, + kEventClassCustom, + kEventCustomProgress, + 0, + kEventAttributeNone, + &evt); + + // This event needs to be targeted at the window so it goes to the window's handler. + if(result == noErr) + { + EventTargetRef target = GetWindowEventTarget(gWindow); + result = SetEventParameter ( + evt, + kEventParamPostTarget, + typeEventTargetRef, + sizeof(target), + &target); + } + + if(result == noErr) + { + result = SetEventParameter ( + evt, + kEventParamCustomCurValue, + typeLongInteger, + sizeof(cur), + &cur); + } + + if(result == noErr) + { + result = SetEventParameter ( + evt, + kEventParamCustomMaxValue, + typeLongInteger, + sizeof(max), + &max); + } + + if(result == noErr) + { + if(text != NULL) + { + result = SetEventParameter ( + evt, + kEventParamCustomText, + typeCFStringRef, + sizeof(text), + &text); + } + } + + if(result == noErr) + { + // Send the event + PostEventToQueue( + GetMainEventQueue(), + evt, + kEventPriorityStandard); + + } + + return(result); +} + +OSStatus sendDone(void) +{ + OSStatus result; + EventRef evt; + + result = CreateEvent( + NULL, + kEventClassCustom, + kEventCustomDone, + 0, + kEventAttributeNone, + &evt); + + // This event needs to be targeted at the window so it goes to the window's handler. + if(result == noErr) + { + EventTargetRef target = GetWindowEventTarget(gWindow); + result = SetEventParameter ( + evt, + kEventParamPostTarget, + typeEventTargetRef, + sizeof(target), + &target); + } + + if(result == noErr) + { + // Send the event + PostEventToQueue( + GetMainEventQueue(), + evt, + kEventPriorityStandard); -LLMacUpdater::LLMacUpdater(): - mUpdateURL (NULL), - mProductName (NULL), - mBundleID (NULL), - mDmgFile (NULL), - mMarkerPath (NULL) + } + + return(result); +} + +OSStatus dialogHandler(EventHandlerCallRef handler, EventRef event, void *userdata) { - sInstance = this; + OSStatus result = eventNotHandledErr; + OSStatus err; + UInt32 evtClass = GetEventClass(event); + UInt32 evtKind = GetEventKind(event); + + if((evtClass == kEventClassCommand) && (evtKind == kEventCommandProcess)) + { + HICommand cmd; + err = GetEventParameter(event, kEventParamDirectObject, typeHICommand, NULL, sizeof(cmd), NULL, &cmd); + + if(err == noErr) + { + switch(cmd.commandID) + { + case kHICommandCancel: + gCancelled = true; +// QuitAppModalLoopForWindow(gWindow); + result = noErr; + break; + } + } + } + else if((evtClass == kEventClassCustom) && (evtKind == kEventCustomProgress)) + { + // Request to update the progress dialog + long cur = 0; + long max = 0; + CFStringRef text = NULL; + (void) GetEventParameter(event, kEventParamCustomCurValue, typeLongInteger, NULL, sizeof(cur), NULL, &cur); + (void) GetEventParameter(event, kEventParamCustomMaxValue, typeLongInteger, NULL, sizeof(max), NULL, &max); + (void) GetEventParameter(event, kEventParamCustomText, typeCFStringRef, NULL, sizeof(text), NULL, &text); + + err = setProgress(cur, max); + if(err == noErr) + { + if(text != NULL) + { + setProgressText(text); + } + } + + result = noErr; + } + else if((evtClass == kEventClassCustom) && (evtKind == kEventCustomDone)) + { + // We're done. Exit the modal loop. + QuitAppModalLoopForWindow(gWindow); + result = noErr; + } + + return(result); } -void LLMacUpdater::doUpdate() +#if 0 +size_t curl_download_callback(void *data, size_t size, size_t nmemb, + void *user_data) { - // We assume that all the logs we're looking for reside on the current drive + S32 bytes = size * nmemb; + char *cdata = (char *) data; + for (int i =0; i < bytes; i += 1) + { + gServerResponse.append(cdata[i]); + } + return bytes; +} +#endif + +int curl_progress_callback_func(void *clientp, + double dltotal, + double dlnow, + double ultotal, + double ulnow) +{ + int max = (int)(dltotal / 1024.0); + int cur = (int)(dlnow / 1024.0); + sendProgress(cur, max); + + if(gCancelled) + return(1); + + return(0); +} + +int parse_args(int argc, char **argv) +{ + int j; + + for (j = 1; j < argc; j++) + { + if ((!strcmp(argv[j], "-url")) && (++j < argc)) + { + gUpdateURL = argv[j]; + } + else if ((!strcmp(argv[j], "-name")) && (++j < argc)) + { + gProductName = argv[j]; + } + else if ((!strcmp(argv[j], "-bundleid")) && (++j < argc)) + { + gBundleID = argv[j]; + } + else if ((!strcmp(argv[j], "-dmg")) && (++j < argc)) + { + gDmgFile = argv[j]; + } + else if ((!strcmp(argv[j], "-marker")) && (++j < argc)) + { + gMarkerPath = argv[j];; + } + } + + return 0; +} + +int main(int argc, char **argv) +{ + // We assume that all the logs we're looking for reside on the current drive gDirUtilp->initAppDirs("SecondLife"); - + LLError::initForApplication( gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "")); - + // Rename current log file to ".old" std::string old_log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "updater.log.old"); std::string log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "updater.log"); LLFile::rename(log_file.c_str(), old_log_file.c_str()); - + // Set the log file to updater.log LLError::logToFile(log_file); - - if ((mUpdateURL == NULL) && (mDmgFile == NULL)) + + ///////////////////////////////////////// + // + // Process command line arguments + // + gUpdateURL = NULL; + gProductName = NULL; + gBundleID = NULL; + gDmgFile = NULL; + gMarkerPath = NULL; + parse_args(argc, argv); + if ((gUpdateURL == NULL) && (gDmgFile == NULL)) { llinfos << "Usage: mac_updater -url | -dmg [-name ] [-program ]" << llendl; exit(1); } else { - llinfos << "Update url is: " << mUpdateURL << llendl; - if (mProductName) + llinfos << "Update url is: " << gUpdateURL << llendl; + if (gProductName) { - llinfos << "Product name is: " << *mProductName << llendl; + llinfos << "Product name is: " << gProductName << llendl; } else { - mProductName = new std::string("Second Life"); + gProductName = "Second Life"; } - if (mBundleID) + if (gBundleID) { - llinfos << "Bundle ID is: " << *mBundleID << llendl; + llinfos << "Bundle ID is: " << gBundleID << llendl; } else { - mBundleID = new std::string("com.secondlife.indra.viewer"); + gBundleID = "com.secondlife.indra.viewer"; } } - llinfos << "Starting " << *mProductName << " Updater" << llendl; - - pthread_create(&updatethread, - NULL, - &sUpdatethreadproc, - NULL); - - + llinfos << "Starting " << gProductName << " Updater" << llendl; + + // Real UI... + OSStatus err; + IBNibRef nib = NULL; + + err = CreateNibReference(CFSTR("AutoUpdater"), &nib); + + char windowTitle[MAX_PATH]; /* Flawfinder: ignore */ + snprintf(windowTitle, sizeof(windowTitle), "%s Updater", gProductName); + CFStringRef windowTitleRef = NULL; + windowTitleRef = CFStringCreateWithCString(NULL, windowTitle, kCFStringEncodingUTF8); + + if(err == noErr) + { + err = CreateWindowFromNib(nib, CFSTR("Updater"), &gWindow); + } + + if (err == noErr) + { + err = SetWindowTitleWithCFString(gWindow, windowTitleRef); + } + CFRelease(windowTitleRef); + + if(err == noErr) + { + // Set up an event handler for the window. + EventTypeSpec handlerEvents[] = + { + { kEventClassCommand, kEventCommandProcess }, + { kEventClassCustom, kEventCustomProgress }, + { kEventClassCustom, kEventCustomDone } + }; + InstallStandardEventHandler(GetWindowEventTarget(gWindow)); + InstallWindowEventHandler( + gWindow, + NewEventHandlerUPP(dialogHandler), + GetEventTypeCount (handlerEvents), + handlerEvents, + 0, + &gEventHandler); + } + + if(err == noErr) + { + ShowWindow(gWindow); + SelectWindow(gWindow); + } + + if(err == noErr) + { + pthread_create(&updatethread, + NULL, + &updatethreadproc, + NULL); + + } + + if(err == noErr) + { + RunAppModalLoopForWindow(gWindow); + } + void *threadresult; - + pthread_join(updatethread, &threadresult); - - if(gCancelled || gFailure) + + if(!gCancelled && (gFailure != noErr)) { - sendStopAlert(); - - if(mMarkerPath != 0) + // Something went wrong. Since we always just tell the user to download a new version, we don't really care what. + AlertStdCFStringAlertParamRec params; + SInt16 retval_mac = 1; + DialogRef alert = NULL; + OSStatus err; + + params.version = kStdCFStringAlertVersionOne; + params.movable = false; + params.helpButton = false; + params.defaultText = (CFStringRef)kAlertDefaultOKText; + params.cancelText = 0; + params.otherText = 0; + params.defaultButton = 1; + params.cancelButton = 0; + params.position = kWindowDefaultPosition; + params.flags = 0; + + err = CreateStandardAlert( + kAlertStopAlert, + CFSTR("Error"), + CFSTR("An error occurred while updating Second Life. Please download the latest version from www.secondlife.com."), + ¶ms, + &alert); + + if(err == noErr) + { + err = RunStandardAlert( + alert, + NULL, + &retval_mac); + } + + if(gMarkerPath != 0) { // Create a install fail marker that can be used by the viewer to // detect install problems. - std::ofstream stream(mMarkerPath->c_str()); + std::ofstream stream(gMarkerPath); if(stream) stream << -1; } exit(-1); } else { exit(0); } + + if(gWindow != NULL) + { + DisposeWindow(gWindow); + } - return; + if(nib != NULL) + { + DisposeNibReference(nib); + } + + return 0; } -//SPATTERS TODO this should be moved to lldir_mac.cpp -const std::string LLMacUpdater::walkParents( signed int depth, const std::string& childpath ) +bool isDirWritable(FSRef &dir) { - boost::filesystem::path fullpath(childpath.c_str()); - - while (depth > 0 && fullpath.has_parent_path()) - { - fullpath = boost::filesystem::path(fullpath.parent_path()); - --depth; - } - - return fullpath.string(); -} + bool result = false; + + // Test for a writable directory by creating a directory, then deleting it again. + // This is kinda lame, but will pretty much always give the right answer. + + OSStatus err = noErr; + char temp[PATH_MAX] = ""; /* Flawfinder: ignore */ -//#if 0 -//size_t curl_download_callback(void *data, size_t size, size_t nmemb, -// void *user_data) -//{ -// S32 bytes = size * nmemb; -// char *cdata = (char *) data; -// for (int i =0; i < bytes; i += 1) -// { -// gServerResponse.append(cdata[i]); -// } -// return bytes; -//} -//#endif + err = FSRefMakePath(&dir, (UInt8*)temp, sizeof(temp)); -int curl_progress_callback_func(void *clientp, - double dltotal, - double dlnow, - double ultotal, - double ulnow) -{ - int max = (int)(dltotal / 1024.0); - int cur = (int)(dlnow / 1024.0); - setProgress(cur, max); - - if(gCancelled) - return(1); + if(err == noErr) + { + strncat(temp, "/.test_XXXXXX", (sizeof(temp) - strlen(temp)) - 1); + + if(mkdtemp(temp) != NULL) + { + // We were able to make the directory. This means the directory is writable. + result = true; + + // Clean up. + rmdir(temp); + } + } - return(0); -} +#if 0 + // This seemed like a good idea, but won't tell us if we're on a volume mounted read-only. + UInt8 perm; + err = FSGetUserPrivilegesPermissions(&targetParentRef, &perm, NULL); + if(err == noErr) + { + if(perm & kioACUserNoMakeChangesMask) + { + // Parent directory isn't writable. + llinfos << "Target parent directory not writable." << llendl; + err = -1; + replacingTarget = false; + } + } +#endif -bool LLMacUpdater::isApplication(const std::string& app_str) -{ - return !(bool) app_str.compare( app_str.length()-4, 4, ".app"); + return result; } - -// Search through the directory specified by 'parent' for an item that appears to be a Second Life viewer. -bool LLMacUpdater::findAppBundleOnDiskImage(const boost::filesystem::path& dir_path, - boost::filesystem::path& path_found) + +static std::string HFSUniStr255_to_utf8str(const HFSUniStr255* src) { - if ( !boost::filesystem::exists( dir_path ) ) return false; - - boost::filesystem::directory_iterator end_itr; - - for ( boost::filesystem::directory_iterator itr( dir_path ); - itr != end_itr; - ++itr ) - { - if ( boost::filesystem::is_directory(itr->status()) ) - { - std::string dir_name = itr->path().string(); - if ( isApplication(dir_name) ) - { - if(isFSRefViewerBundle(dir_name)) - { - llinfos << dir_name << " is the one" << llendl; - - path_found = itr->path(); - return true; - } - } - } - } - return false; + llutf16string string16((U16*)&(src->unicode), src->length); + std::string result = utf16str_to_utf8str(string16); + return result; } -bool LLMacUpdater::verifyDirectory(const boost::filesystem::path* directory, bool isParent) +int restoreObject(const char* aside, const char* target, const char* path, const char* object) { - bool replacingTarget; - std::string app_str = directory->string(); - - if (boost::filesystem::is_directory(*directory)) - { - // This is fine, just means we're not replacing anything. - replacingTarget = true; - } - else - { - replacingTarget = isParent; - } - - //Check that the directory is writeable. - if(!isDirWritable(app_str)) - { - // Parent directory isn't writable. - llinfos << "Target directory not writable." << llendl; - replacingTarget = false; - } - return replacingTarget; + char source[PATH_MAX] = ""; /* Flawfinder: ignore */ + char dest[PATH_MAX] = ""; /* Flawfinder: ignore */ + snprintf(source, sizeof(source), "%s/%s/%s", aside, path, object); + snprintf(dest, sizeof(dest), "%s/%s", target, path); + FSRef sourceRef; + FSRef destRef; + OSStatus err; + err = FSPathMakeRef((UInt8 *)source, &sourceRef, NULL); + if(err != noErr) return false; + err = FSPathMakeRef((UInt8 *)dest, &destRef, NULL); + if(err != noErr) return false; + + llinfos << "Copying " << source << " to " << dest << llendl; + + err = FSCopyObjectSync( + &sourceRef, + &destRef, + NULL, + NULL, + kFSFileOperationOverwrite); + + if(err != noErr) return false; + return true; } - -bool LLMacUpdater::getViewerDir(boost::filesystem::path &app_dir) + +// Replace any mention of "Second Life" with the product name. +void filterFile(const char* filename) { - std::string app_dir_str; - - //Walk up 6 levels from the App Updater's installation point. - app_dir_str = walkParents( 6, *mApplicationPath ); - - app_dir = boost::filesystem::path(app_dir_str); - - //Check to see that the directory's name ends in .app Lame but it's the best thing we have to go on. - //If it's not there, we're going to default to /Applications/VIEWERNAME - if (!isApplication(app_dir_str)) - { - llinfos << "Target search failed, defaulting to /Applications/" << *mProductName << ".app." << llendl; - std::string newpath = std::string("/Applications/") + mProductName->c_str(); - app_dir = boost::filesystem::path(newpath); - } - return verifyDirectory(&app_dir); + char temp[PATH_MAX] = ""; /* Flawfinder: ignore */ + // First copy the target's version, so we can run it through sed. + snprintf(temp, sizeof(temp), "cp '%s' '%s.tmp'", filename, filename); + system(temp); /* Flawfinder: ignore */ + + // Now run it through sed. + snprintf(temp, sizeof(temp), + "sed 's/Second Life/%s/g' '%s.tmp' > '%s'", gProductName, filename, filename); + system(temp); /* Flawfinder: ignore */ } -bool LLMacUpdater::downloadDMG(const std::string& dmgName, boost::filesystem::path* temp_dir) +static bool isFSRefViewerBundle(FSRef *targetRef) { - LLFILE *downloadFile = NULL; - char temp[PATH_MAX] = ""; /* Flawfinder: ignore */ + bool result = false; + CFURLRef targetURL = NULL; + CFBundleRef targetBundle = NULL; + CFStringRef targetBundleID = NULL; + CFStringRef sourceBundleID = NULL; - chdir(temp_dir->string().c_str()); - - snprintf(temp, sizeof(temp), "SecondLife.dmg"); - - downloadFile = LLFile::fopen(temp, "wb"); /* Flawfinder: ignore */ - if(downloadFile == NULL) - { - return false; - } - - bool success = false; - - CURL *curl = curl_easy_init(); - - curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1); - // curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &curl_download_callback); - curl_easy_setopt(curl, CURLOPT_FILE, downloadFile); - curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0); - curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, &curl_progress_callback_func); - curl_easy_setopt(curl, CURLOPT_URL, mUpdateURL); - curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); - - sendProgress(0, 1, std::string("Downloading...")); - - CURLcode result = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - - if(gCancelled) - { - llinfos << "User cancel, bailing out."<< llendl; - goto close_file; - } - - if(result != CURLE_OK) - { - llinfos << "Error " << result << " while downloading disk image."<< llendl; - goto close_file; - } - - fclose(downloadFile); - downloadFile = NULL; - - success = true; - -close_file: - // Close disk image file if necessary - if(downloadFile != NULL) + targetURL = CFURLCreateFromFSRef(NULL, targetRef); + + if(targetURL == NULL) { - llinfos << "Closing download file." << llendl; - - fclose(downloadFile); - downloadFile = NULL; + llinfos << "Error creating target URL." << llendl; } - - return success; -} - -bool LLMacUpdater::doMount(const std::string& dmgName, char* deviceNode, const boost::filesystem::path& temp_dir) -{ - char temp[PATH_MAX] = ""; /* Flawfinder: ignore */ - - sendProgress(0, 0, std::string("Mounting image...")); - chdir(temp_dir.string().c_str()); - std::string mnt_dir = temp_dir.string() + std::string("/mnt"); - LLFile::mkdir(mnt_dir.c_str(), 0700); - - // NOTE: we could add -private at the end of this command line to keep the image from showing up in the Finder, - // but if our cleanup fails, this makes it much harder for the user to unmount the image. - std::string mountOutput; - boost::format cmdFormat("hdiutil attach %s -mountpoint mnt"); - cmdFormat % dmgName; - FILE* mounter = popen(cmdFormat.str().c_str(), "r"); /* Flawfinder: ignore */ - - if(mounter == NULL) - { - llinfos << "Failed to mount disk image, exiting."<< llendl; - return false; - } - - // We need to scan the output from hdiutil to find the device node it uses to attach the disk image. - // If we don't have this information, we can't detach it later. - while(mounter != NULL) - { - size_t len = fread(temp, 1, sizeof(temp)-1, mounter); - temp[len] = 0; - mountOutput.append(temp); - if(len < sizeof(temp)-1) - { - // End of file or error. - int result = pclose(mounter); - if(result != 0) - { - // NOTE: We used to abort here, but pclose() started returning - // -1, possibly when the size of the DMG passed a certain point - llinfos << "Unexpected result closing pipe: " << result << llendl; - } - mounter = NULL; - } - } - - if(!mountOutput.empty()) - { - const char *s = mountOutput.c_str(); - const char *prefix = "/dev/"; - char *sub = strstr(s, prefix); - - if(sub != NULL) - { - sub += strlen(prefix); /* Flawfinder: ignore */ - sscanf(sub, "%1023s", deviceNode); /* Flawfinder: ignore */ - } - } - - if(deviceNode[0] != 0) - { - llinfos << "Disk image attached on /dev/" << deviceNode << llendl; - } - else - { - llinfos << "Disk image device node not found!" << llendl; - return false; - } - - return true; + else + { + targetBundle = CFBundleCreate(NULL, targetURL); + } + + if(targetBundle == NULL) + { + llinfos << "Failed to create target bundle." << llendl; + } + else + { + targetBundleID = CFBundleGetIdentifier(targetBundle); + } + + if(targetBundleID == NULL) + { + llinfos << "Couldn't retrieve target bundle ID." << llendl; + } + else + { + sourceBundleID = CFStringCreateWithCString(NULL, gBundleID, kCFStringEncodingUTF8); + if(CFStringCompare(sourceBundleID, targetBundleID, 0) == kCFCompareEqualTo) + { + // This is the bundle we're looking for. + result = true; + } + else + { + llinfos << "Target bundle ID mismatch." << llendl; + } + } + + // Don't release targetBundleID -- since we don't retain it, it's released when targetBundle is released. + if(targetURL != NULL) + CFRelease(targetURL); + if(targetBundle != NULL) + CFRelease(targetBundle); + + return result; } -bool LLMacUpdater::moveApplication (const boost::filesystem::path& app_dir, - const boost::filesystem::path& temp_dir, - boost::filesystem::path& aside_dir) +// Search through the directory specified by 'parent' for an item that appears to be a Second Life viewer. +static OSErr findAppBundleOnDiskImage(FSRef *parent, FSRef *app) { - try - { - //Grab filename from installdir append to tempdir move set aside_dir to moved path. - std::string install_str = app_dir.parent_path().string(); - std::string temp_str = temp_dir.string(); - std::string app_str = app_dir.filename().string(); - aside_dir = boost::filesystem::path( boost::filesystem::operator/(temp_dir,app_str) ); - std::cout << "Attempting to move " << app_dir.string() << " to " << aside_dir.string() << std::endl; - - boost::filesystem::rename(app_dir, aside_dir); - } - catch(boost::filesystem::filesystem_error e) - { - llinfos << "Application move failed." << llendl; - return false; - } - return true; -} + FSIterator iterator; + bool found = false; + + OSErr err = FSOpenIterator( parent, kFSIterateFlat, &iterator ); + if(!err) + { + do + { + ItemCount actualObjects = 0; + Boolean containerChanged = false; + FSCatalogInfo info; + FSRef ref; + HFSUniStr255 unicodeName; + err = FSGetCatalogInfoBulk( + iterator, + 1, + &actualObjects, + &containerChanged, + kFSCatInfoNodeFlags, + &info, + &ref, + NULL, + &unicodeName ); + + if(actualObjects == 0) + break; + + if(!err) + { + // Call succeeded and not done with the iteration. + std::string name = HFSUniStr255_to_utf8str(&unicodeName); + + llinfos << "Considering \"" << name << "\"" << llendl; + + if(info.nodeFlags & kFSNodeIsDirectoryMask) + { + // This is a directory. See if it's a .app + if(name.find(".app") != std::string::npos) + { + // Looks promising. Check to see if it has the right bundle identifier. + if(isFSRefViewerBundle(&ref)) + { + llinfos << name << " is the one" << llendl; + // This is the one. Return it. + *app = ref; + found = true; + break; + } else { + llinfos << name << " is not the bundle we are looking for; move along" << llendl; + } -bool LLMacUpdater::doInstall(const boost::filesystem::path& app_dir, - const boost::filesystem::path& temp_dir, - boost::filesystem::path& mount_dir, - bool replacingTarget) -{ - std::string temp_name = temp_dir.string() + std::string("/mnt"); - - llinfos << "Disk image mount point is: " << temp_name << llendl; - - mount_dir = boost::filesystem::path(temp_name.c_str()); - - if (! boost::filesystem::exists ( mount_dir ) ) - { - llinfos << "Couldn't make FSRef to disk image mount point." << llendl; - return false; - } - - sendProgress(0, 0, std::string("Searching for the app bundle...")); - - boost::filesystem::path source_dir; - - if ( !findAppBundleOnDiskImage(mount_dir, source_dir) ) - { - llinfos << "Couldn't find application bundle on mounted disk image." << llendl; - return false; - } - else - { - llinfos << "found the bundle." << llendl; - } - - sendProgress(0, 0, std::string("Preparing to copy files...")); - - // this will hold the name of the destination target - boost::filesystem::path aside_dir; - - if(replacingTarget) - { - - if (! moveApplication (app_dir, temp_dir, aside_dir) ) - { - llwarns << "failed to move aside old version." << llendl; - return false; - } - } - - sendProgress(0, 0, std::string("Copying files...")); - - llinfos << "Starting copy..." << llendl; - // If we were replacingTarget, we've moved the app to a temp directory. - // Otherwise the destination should be empty. - // We have mounted the DMG as a volume so we should be able to just - // move the app from the volume to the destination and everything will just work. - - - // Copy the new version from the disk image to the target location. - - //The installer volume is mounted read-only so we can't move. Instead copy and then unmount. - if (! copyDir(source_dir.string(), app_dir.string()) ) - { - llwarns << "Failed to copy " << source_dir.string() << " to " << app_dir.string() << llendl; - - // Something went wrong during the copy. Attempt to put the old version back and bail. - boost::filesystem::rename(app_dir, aside_dir); - return false; - - } - - // The update has succeeded. Clear the cache directory. - - sendProgress(0, 0, std::string("Clearing cache...")); - - llinfos << "Clearing cache..." << llendl; - - gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""), "*.*"); - - llinfos << "Clear complete." << llendl; - - return true; + } + } + } + } + while(!err); + + llinfos << "closing the iterator" << llendl; + + FSCloseIterator(iterator); + + llinfos << "closed" << llendl; + } + + if(!err && !found) + err = fnfErr; + + return err; } -void* LLMacUpdater::updatethreadproc(void*) +void *updatethreadproc(void*) { char tempDir[PATH_MAX] = ""; /* Flawfinder: ignore */ + FSRef tempDirRef; char temp[PATH_MAX] = ""; /* Flawfinder: ignore */ // *NOTE: This buffer length is used in a scanf() below. char deviceNode[1024] = ""; /* Flawfinder: ignore */ - - bool replacingTarget = false; - - boost::filesystem::path app_dir; - boost::filesystem::path temp_dir; - boost::filesystem::path mount_dir; - - // Attempt to get a reference to the Second Life application bundle containing this updater. - // Any failures during this process will cause us to default to updating /Applications/Second Life.app + LLFILE *downloadFile = NULL; + OSStatus err; + ProcessSerialNumber psn; + char target[PATH_MAX] = ""; /* Flawfinder: ignore */ + FSRef targetRef; + FSRef targetParentRef; + FSVolumeRefNum targetVol; + FSRef trashFolderRef; + Boolean replacingTarget = false; + memset(&tempDirRef, 0, sizeof(tempDirRef)); + memset(&targetRef, 0, sizeof(targetRef)); + memset(&targetParentRef, 0, sizeof(targetParentRef)); + try - { - replacingTarget = getViewerDir( app_dir ); - - if (!mkTempDir(temp_dir)) - { - throw 0; - } - - //In case the dir doesn't exist, try to create it. If create fails, verify it exists. - if (! boost::filesystem::create_directory(app_dir)) - { - - - if(isFSRefViewerBundle(app_dir.string())) - { - // This is the bundle we're looking for. - replacingTarget = true; - } - else - { - throw 0; - } - } - - if ( !verifyDirectory(&app_dir, true) ) - { - // We're so hosed. - llinfos << "Applications directory not found, giving up." << llendl; - throw 0; - } + { + // Attempt to get a reference to the Second Life application bundle containing this updater. + // Any failures during this process will cause us to default to updating /Applications/Second Life.app + { + FSRef myBundle; + + err = GetCurrentProcess(&psn); + if(err == noErr) + { + err = GetProcessBundleLocation(&psn, &myBundle); + } + + if(err == noErr) + { + // Sanity check: Make sure the name of the item referenced by targetRef is "Second Life.app". + FSRefMakePath(&myBundle, (UInt8*)target, sizeof(target)); + + llinfos << "Updater bundle location: " << target << llendl; + } + + // Our bundle should be in Second Life.app/Contents/Resources/AutoUpdater.app + // so we need to go up 3 levels to get the path to the main application bundle. + if(err == noErr) + { + err = FSGetCatalogInfo(&myBundle, kFSCatInfoNone, NULL, NULL, NULL, &targetRef); + } + if(err == noErr) + { + err = FSGetCatalogInfo(&targetRef, kFSCatInfoNone, NULL, NULL, NULL, &targetRef); + } + if(err == noErr) + { + err = FSGetCatalogInfo(&targetRef, kFSCatInfoNone, NULL, NULL, NULL, &targetRef); + } + + // And once more to get the parent of the target + if(err == noErr) + { + err = FSGetCatalogInfo(&targetRef, kFSCatInfoNone, NULL, NULL, NULL, &targetParentRef); + } + + if(err == noErr) + { + FSRefMakePath(&targetRef, (UInt8*)target, sizeof(target)); + llinfos << "Path to target: " << target << llendl; + } + + // Sanity check: make sure the target is a bundle with the right identifier + if(err == noErr) + { + // Assume the worst... + err = -1; + + if(isFSRefViewerBundle(&targetRef)) + { + // This is the bundle we're looking for. + err = noErr; + replacingTarget = true; + } + } + + // Make sure the target's parent directory is writable. + if(err == noErr) + { + if(!isDirWritable(targetParentRef)) + { + // Parent directory isn't writable. + llinfos << "Target parent directory not writable." << llendl; + err = -1; + replacingTarget = false; + } + } + + if(err != noErr) + { + Boolean isDirectory; + llinfos << "Target search failed, defaulting to /Applications/" << gProductName << ".app." << llendl; + + // Set up the parent directory + err = FSPathMakeRef((UInt8*)"/Applications", &targetParentRef, &isDirectory); + if((err != noErr) || (!isDirectory)) + { + // We're so hosed. + llinfos << "Applications directory not found, giving up." << llendl; + throw 0; + } + + snprintf(target, sizeof(target), "/Applications/%s.app", gProductName); + + memset(&targetRef, 0, sizeof(targetRef)); + err = FSPathMakeRef((UInt8*)target, &targetRef, NULL); + if(err == fnfErr) + { + // This is fine, just means we're not replacing anything. + err = noErr; + replacingTarget = false; + } + else + { + replacingTarget = true; + } + + // Make sure the target's parent directory is writable. + if(err == noErr) + { + if(!isDirWritable(targetParentRef)) + { + // Parent directory isn't writable. + llinfos << "Target parent directory not writable." << llendl; + err = -1; + replacingTarget = false; + } + } + + } + + // If we haven't fixed all problems by this point, just bail. + if(err != noErr) + { + llinfos << "Unable to pick a target, giving up." << llendl; + throw 0; + } + } + + // Find the volID of the volume the target resides on + { + FSCatalogInfo info; + err = FSGetCatalogInfo( + &targetParentRef, + kFSCatInfoVolume, + &info, + NULL, + NULL, + NULL); + + if(err != noErr) + throw 0; + + targetVol = info.volume; + } + + // Find the temporary items and trash folders on that volume. + err = FSFindFolder( + targetVol, + kTrashFolderType, + true, + &trashFolderRef); + + if(err != noErr) + throw 0; + +#if 0 // *HACK for DEV-11935 see below for details. + + FSRef tempFolderRef; + + err = FSFindFolder( + targetVol, + kTemporaryFolderType, + true, + &tempFolderRef); + + if(err != noErr) + throw 0; + + err = FSRefMakePath(&tempFolderRef, (UInt8*)temp, sizeof(temp)); + + if(err != noErr) + throw 0; + +#else + + // *HACK for DEV-11935 the above kTemporaryFolderType query was giving + // back results with path names that seem to be too long to be used as + // mount points. I suspect this incompatibility was introduced in the + // Leopard 10.5.2 update, but I have not verified this. + char const HARDCODED_TMP[] = "/tmp"; + strncpy(temp, HARDCODED_TMP, sizeof(HARDCODED_TMP)); + +#endif // 0 *HACK for DEV-11935 // Skip downloading the file if the dmg was passed on the command line. std::string dmgName; - if(mDmgFile != NULL) { - //Create a string from the mDmgFile then a dir reference to that. - //change to that directory and begin install. - - boost::filesystem::path dmg_path(*mDmgFile); - - dmgName = dmg_path.string(); - std::string* dmgPath = new std::string(dmg_path.parent_path().string()); - if ( !boost::filesystem::exists( dmg_path.parent_path() ) ) { - llinfos << "Path " << *dmgPath << " is not writeable. Aborting." << llendl; - throw 0; - } - - chdir(dmgPath->c_str()); + if(gDmgFile != NULL) { + dmgName = basename((char *)gDmgFile); + char * dmgDir = dirname((char *)gDmgFile); + strncpy(tempDir, dmgDir, sizeof(tempDir)); + err = FSPathMakeRef((UInt8*)tempDir, &tempDirRef, NULL); + if(err != noErr) throw 0; + chdir(tempDir); + goto begin_install; } else { // Continue on to download file. dmgName = "SecondLife.dmg"; - - - if (!downloadDMG(dmgName, &temp_dir)) - { - throw 0; - } - } - - if (!doMount(dmgName, deviceNode, temp_dir)) - { - throw 0; - } - - if (!doInstall( app_dir, temp_dir, mount_dir, replacingTarget )) - { - throw 0; - } + } + + + strncat(temp, "/SecondLifeUpdate_XXXXXX", (sizeof(temp) - strlen(temp)) - 1); + if(mkdtemp(temp) == NULL) + { + throw 0; + } + + strncpy(tempDir, temp, sizeof(tempDir)); + temp[sizeof(tempDir) - 1] = '\0'; + + llinfos << "tempDir is " << tempDir << llendl; + + err = FSPathMakeRef((UInt8*)tempDir, &tempDirRef, NULL); + + if(err != noErr) + throw 0; + + chdir(tempDir); + + snprintf(temp, sizeof(temp), "SecondLife.dmg"); + + downloadFile = LLFile::fopen(temp, "wb"); /* Flawfinder: ignore */ + if(downloadFile == NULL) + { + throw 0; + } + + { + CURL *curl = curl_easy_init(); + + curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1); + // curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &curl_download_callback); + curl_easy_setopt(curl, CURLOPT_FILE, downloadFile); + curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0); + curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, &curl_progress_callback_func); + curl_easy_setopt(curl, CURLOPT_URL, gUpdateURL); + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); + + sendProgress(0, 1, CFSTR("Downloading...")); + + CURLcode result = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + + if(gCancelled) + { + llinfos << "User cancel, bailing out."<< llendl; + throw 0; + } + + if(result != CURLE_OK) + { + llinfos << "Error " << result << " while downloading disk image."<< llendl; + throw 0; + } + + fclose(downloadFile); + downloadFile = NULL; + } + + begin_install: + sendProgress(0, 0, CFSTR("Mounting image...")); + LLFile::mkdir("mnt", 0700); + + // NOTE: we could add -private at the end of this command line to keep the image from showing up in the Finder, + // but if our cleanup fails, this makes it much harder for the user to unmount the image. + std::string mountOutput; + boost::format cmdFormat("hdiutil attach %s -mountpoint mnt"); + cmdFormat % dmgName; + FILE* mounter = popen(cmdFormat.str().c_str(), "r"); /* Flawfinder: ignore */ + + if(mounter == NULL) + { + llinfos << "Failed to mount disk image, exiting."<< llendl; + throw 0; + } + + // We need to scan the output from hdiutil to find the device node it uses to attach the disk image. + // If we don't have this information, we can't detach it later. + while(mounter != NULL) + { + size_t len = fread(temp, 1, sizeof(temp)-1, mounter); + temp[len] = 0; + mountOutput.append(temp); + if(len < sizeof(temp)-1) + { + // End of file or error. + int result = pclose(mounter); + if(result != 0) + { + // NOTE: We used to abort here, but pclose() started returning + // -1, possibly when the size of the DMG passed a certain point + llinfos << "Unexpected result closing pipe: " << result << llendl; + } + mounter = NULL; + } + } + + if(!mountOutput.empty()) + { + const char *s = mountOutput.c_str(); + const char *prefix = "/dev/"; + char *sub = strstr(s, prefix); + + if(sub != NULL) + { + sub += strlen(prefix); /* Flawfinder: ignore */ + sscanf(sub, "%1023s", deviceNode); /* Flawfinder: ignore */ + } + } + + if(deviceNode[0] != 0) + { + llinfos << "Disk image attached on /dev/" << deviceNode << llendl; + } + else + { + llinfos << "Disk image device node not found!" << llendl; + throw 0; + } + + // Get an FSRef to the new application on the disk image + FSRef sourceRef; + FSRef mountRef; + snprintf(temp, sizeof(temp), "%s/mnt", tempDir); + + llinfos << "Disk image mount point is: " << temp << llendl; + err = FSPathMakeRef((UInt8 *)temp, &mountRef, NULL); + if(err != noErr) + { + llinfos << "Couldn't make FSRef to disk image mount point." << llendl; + throw 0; + } + + sendProgress(0, 0, CFSTR("Searching for the app bundle...")); + err = findAppBundleOnDiskImage(&mountRef, &sourceRef); + if(err != noErr) + { + llinfos << "Couldn't find application bundle on mounted disk image." << llendl; + throw 0; + } + else + { + llinfos << "found the bundle." << llendl; + } + + sendProgress(0, 0, CFSTR("Preparing to copy files...")); + + FSRef asideRef; + char aside[MAX_PATH]; /* Flawfinder: ignore */ + + // this will hold the name of the destination target + CFStringRef appNameRef; + + if(replacingTarget) + { + // Get the name of the target we're replacing + HFSUniStr255 appNameUniStr; + err = FSGetCatalogInfo(&targetRef, 0, NULL, &appNameUniStr, NULL, NULL); + if(err != noErr) + throw 0; + appNameRef = FSCreateStringFromHFSUniStr(NULL, &appNameUniStr); + + // Move aside old version (into work directory) + err = FSMoveObject(&targetRef, &tempDirRef, &asideRef); + if(err != noErr) + { + llwarns << "failed to move aside old version (error code " << + err << ")" << llendl; + throw 0; + } + + // Grab the path for later use. + err = FSRefMakePath(&asideRef, (UInt8*)aside, sizeof(aside)); + } + else + { + // Construct the name of the target based on the product name + char appName[MAX_PATH]; /* Flawfinder: ignore */ + snprintf(appName, sizeof(appName), "%s.app", gProductName); + appNameRef = CFStringCreateWithCString(NULL, appName, kCFStringEncodingUTF8); + } + + sendProgress(0, 0, CFSTR("Copying files...")); + + llinfos << "Starting copy..." << llendl; + + // Copy the new version from the disk image to the target location. + err = FSCopyObjectSync( + &sourceRef, + &targetParentRef, + appNameRef, + &targetRef, + kFSFileOperationDefaultOptions); + + // Grab the path for later use. + err = FSRefMakePath(&targetRef, (UInt8*)target, sizeof(target)); + if(err != noErr) + throw 0; + + llinfos << "Copy complete. Target = " << target << llendl; + + if(err != noErr) + { + // Something went wrong during the copy. Attempt to put the old version back and bail. + (void)FSDeleteObject(&targetRef); + if(replacingTarget) + { + (void)FSMoveObject(&asideRef, &targetParentRef, NULL); + } + throw 0; + } + else + { + // The update has succeeded. Clear the cache directory. + + sendProgress(0, 0, CFSTR("Clearing cache...")); + + llinfos << "Clearing cache..." << llendl; + + gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""), "*.*"); + + llinfos << "Clear complete." << llendl; + + } } catch(...) { if(!gCancelled) - gFailure = true; + if(gFailure == noErr) + gFailure = -1; } // Failures from here on out are all non-fatal and not reported. - sendProgress(0, 3, std::string("Cleaning up...")); + sendProgress(0, 3, CFSTR("Cleaning up...")); - setProgress(1, 3); + // Close disk image file if necessary + if(downloadFile != NULL) + { + llinfos << "Closing download file." << llendl; + + fclose(downloadFile); + downloadFile = NULL; + } + + sendProgress(1, 3); // Unmount image if(deviceNode[0] != 0) { @@ -599,61 +1223,35 @@ void* LLMacUpdater::updatethreadproc(void*) system(temp); /* Flawfinder: ignore */ } - setProgress(2, 3); - std::string *trash_str=getUserTrashFolder(); + sendProgress(2, 3); // Move work directory to the trash if(tempDir[0] != 0) { llinfos << "Moving work directory to the trash." << llendl; - - try - { - boost::filesystem::path trash_dir(*trash_str); - boost::filesystem::rename(mount_dir, trash_dir); - } - catch(boost::filesystem::filesystem_error e) - { - llwarns << "Failed to move " << mount_dir.string() << " to " << *trash_str << llendl; - return (NULL); - } + + FSRef trashRef; + OSStatus err = FSMoveObjectToTrashSync(&tempDirRef, &trashRef, 0); + if(err != noErr) { + llwarns << "failed to move files to trash, (error code " << + err << ")" << llendl; + } } - std::string app_name_str = app_dir.string(); - - if(!gCancelled && !gFailure && !app_name_str.empty()) + if(!gCancelled && !gFailure && (target[0] != 0)) { - //SPATTERS todo is there no better way to do this than system calls? llinfos << "Touching application bundle." << llendl; - - std::stringstream touch_str; - touch_str << "touch '" << app_name_str << "'"; - - system(touch_str.str().c_str()); /* Flawfinder: ignore */ + snprintf(temp, sizeof(temp), "touch '%s'", target); + system(temp); /* Flawfinder: ignore */ llinfos << "Launching updated application." << llendl; - - std::stringstream open_str; - - open_str << "open '" << app_name_str << "'"; - system(open_str.str().c_str()); /* Flawfinder: ignore */ + snprintf(temp, sizeof(temp), "open '%s'", target); + system(temp); /* Flawfinder: ignore */ } sendDone(); - return (NULL); + return(NULL); } - -//static -void* LLMacUpdater::sUpdatethreadproc(void* vptr) -{ - if (!sInstance) - { - llerrs << "LLMacUpdater not instantiated before use. Aborting." << llendl; - return (NULL); - } - return sInstance->updatethreadproc(vptr); -} - -- cgit v1.2.3 From a53323f328dc0f81ed7182979ea0c8aefa2ce19d Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 20 Dec 2012 14:50:42 -0500 Subject: tag merge of DRTVWR-271 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 740260312a..9287168a8c 100755 --- a/.hgtags +++ b/.hgtags @@ -380,3 +380,4 @@ c23d734065ed593b2413385aecd8366d8e0ee96b DRTVWR-257 5cba5f39d0a81d659f24ebc4b5efd025a39e3db1 3.4.3-release 9aa1aa9f1fe13c194695a0b8f0af298296241dc2 DRTVWR-260 18c5f76ac07937e0b64bb874edba0d60a28cec56 DRTVWR-244 +2c4011bbc2b15b82198fd8b51f3a9fe765a08c4d DRTVWR-271 -- cgit v1.2.3 From 0baf43730b1390e6349304372c26a4033f45e7f8 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 20 Dec 2012 15:34:18 -0500 Subject: Added tag 3.4.4-beta3 for changeset 2f8a3ef687bc --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 117f00c7c4..feedde1230 100755 --- a/.hgtags +++ b/.hgtags @@ -388,3 +388,4 @@ b418be80903520c492e1173f3afbc4021cad5d07 DRTVWR-255 b634dec987c16e8c9c938e11e52591d9ead8fa9b DRTVWR-270 cd39255bd23330fd30c04105f2811e941d8524fe 3.4.4-beta2 2c4011bbc2b15b82198fd8b51f3a9fe765a08c4d DRTVWR-271 +2f8a3ef687bc55828abcb17ac1ad7cde70536d7e 3.4.4-beta3 -- cgit v1.2.3 From 747784a9b1abb3ea85abb9fcc05981992be6f485 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 21 Dec 2012 08:52:39 -0500 Subject: MAINT-2168: fail with real message if required var PORT not set. llhttpclient_test.cpp is only supposed to be run by test_llsdmessage_peer.py, as specified in llmessage/CMakeLists.txt. test_llsdmessage_peer.py sets the environment variable PORT before running INTEGRATION_TEST_llhttpclient. While it's not yet clear under what circumstances INTEGRATION_TEST_llhttpclient could find PORT not set (getenv() returning NULL), it's obvious that in that case, the previous code might well crash. Make it at least fail with an explanatory message rather than a mysterious large negative integer. In theory, occurrences of that message could help us solve the underlying issue. --- indra/llmessage/tests/llhttpclient_test.cpp | 36 +++++++++++++++++------------ 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/indra/llmessage/tests/llhttpclient_test.cpp b/indra/llmessage/tests/llhttpclient_test.cpp index a2be307cc8..7c3def6024 100644 --- a/indra/llmessage/tests/llhttpclient_test.cpp +++ b/indra/llmessage/tests/llhttpclient_test.cpp @@ -48,7 +48,7 @@ namespace tut { LLSD storage; - + class LLSDStorageNode : public LLHTTPNode { public: @@ -82,8 +82,13 @@ namespace tut { public: HTTPClientTestData(): - local_server(STRINGIZE("http://127.0.0.1:" << getenv("PORT") << "/")) + PORT(getenv("PORT")), + // Turning NULL PORT into empty string doesn't make things work; + // that's just to keep this initializer from blowing up. We test + // PORT separately in the constructor body. + local_server(STRINGIZE("http://127.0.0.1:" << (PORT? PORT : "") << "/")) { + ensure("Set environment variable PORT to local test server port", PORT); apr_pool_create(&mPool, NULL); LLCurl::initClass(false); mServerPump = new LLPumpIO(mPool); @@ -91,7 +96,7 @@ namespace tut LLHTTPClient::setPump(*mClientPump); } - + ~HTTPClientTestData() { delete mServerPump; @@ -107,7 +112,7 @@ namespace tut LLHTTPStandardServices::useServices(); LLHTTPRegistrar::buildAllServices(root); } - + void runThePump(float timeout = 100.0f) { LLTimer timer; @@ -134,6 +139,7 @@ namespace tut mServerPump = NULL; } + const char* const PORT; const std::string local_server; private: @@ -148,11 +154,11 @@ namespace tut { std::string msg = llformat("error() called when not expected, status %d", - mStatus); + mStatus); fail(msg); } } - + void ensureStatusError() { if (!mSawError) @@ -160,7 +166,7 @@ namespace tut fail("error() wasn't called"); } } - + LLSD getResult() { return mResult; @@ -169,7 +175,7 @@ namespace tut { return mHeader; } - + protected: bool mSawError; U32 mStatus; @@ -187,18 +193,18 @@ namespace tut : mClient(client) { } - + public: static Result* build(HTTPClientTestData& client) { return new Result(client); } - + ~Result() { mClient.mResultDeleted = true; } - + virtual void error(U32 status, const std::string& reason) { mClient.mSawError = true; @@ -216,7 +222,7 @@ namespace tut const LLSD& content) { LLHTTPClient::Responder::completed(status, reason, content); - + mClient.mSawCompleted = true; } @@ -244,12 +250,12 @@ namespace tut mResult.clear(); mHeader.clear(); mResultDeleted = false; - + return Result::build(*this); } }; - - + + typedef test_group HTTPClientTestGroup; typedef HTTPClientTestGroup::object HTTPClientTestObject; HTTPClientTestGroup httpClientTestGroup("http_client"); -- cgit v1.2.3 From 144fcf62fb01c4f98ee6abb587f9a487d5683257 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 21 Dec 2012 09:01:09 -0500 Subject: MAINT-2168: Backed out changeset 797318b62275, pushed to wrong repo This changeset was prematurely pushed to the wrong repository. Back it out to propagate it the right way. --- indra/llmessage/tests/llhttpclient_test.cpp | 36 ++++++++++++----------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/indra/llmessage/tests/llhttpclient_test.cpp b/indra/llmessage/tests/llhttpclient_test.cpp index 7c3def6024..a2be307cc8 100644 --- a/indra/llmessage/tests/llhttpclient_test.cpp +++ b/indra/llmessage/tests/llhttpclient_test.cpp @@ -48,7 +48,7 @@ namespace tut { LLSD storage; - + class LLSDStorageNode : public LLHTTPNode { public: @@ -82,13 +82,8 @@ namespace tut { public: HTTPClientTestData(): - PORT(getenv("PORT")), - // Turning NULL PORT into empty string doesn't make things work; - // that's just to keep this initializer from blowing up. We test - // PORT separately in the constructor body. - local_server(STRINGIZE("http://127.0.0.1:" << (PORT? PORT : "") << "/")) + local_server(STRINGIZE("http://127.0.0.1:" << getenv("PORT") << "/")) { - ensure("Set environment variable PORT to local test server port", PORT); apr_pool_create(&mPool, NULL); LLCurl::initClass(false); mServerPump = new LLPumpIO(mPool); @@ -96,7 +91,7 @@ namespace tut LLHTTPClient::setPump(*mClientPump); } - + ~HTTPClientTestData() { delete mServerPump; @@ -112,7 +107,7 @@ namespace tut LLHTTPStandardServices::useServices(); LLHTTPRegistrar::buildAllServices(root); } - + void runThePump(float timeout = 100.0f) { LLTimer timer; @@ -139,7 +134,6 @@ namespace tut mServerPump = NULL; } - const char* const PORT; const std::string local_server; private: @@ -154,11 +148,11 @@ namespace tut { std::string msg = llformat("error() called when not expected, status %d", - mStatus); + mStatus); fail(msg); } } - + void ensureStatusError() { if (!mSawError) @@ -166,7 +160,7 @@ namespace tut fail("error() wasn't called"); } } - + LLSD getResult() { return mResult; @@ -175,7 +169,7 @@ namespace tut { return mHeader; } - + protected: bool mSawError; U32 mStatus; @@ -193,18 +187,18 @@ namespace tut : mClient(client) { } - + public: static Result* build(HTTPClientTestData& client) { return new Result(client); } - + ~Result() { mClient.mResultDeleted = true; } - + virtual void error(U32 status, const std::string& reason) { mClient.mSawError = true; @@ -222,7 +216,7 @@ namespace tut const LLSD& content) { LLHTTPClient::Responder::completed(status, reason, content); - + mClient.mSawCompleted = true; } @@ -250,12 +244,12 @@ namespace tut mResult.clear(); mHeader.clear(); mResultDeleted = false; - + return Result::build(*this); } }; - - + + typedef test_group HTTPClientTestGroup; typedef HTTPClientTestGroup::object HTTPClientTestObject; HTTPClientTestGroup httpClientTestGroup("http_client"); -- cgit v1.2.3 From 36f094d508f4a04e4a841f24b406c96c5fd331ff Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 21 Dec 2012 09:03:06 -0500 Subject: MAINT-2168: Backed out changeset fb93eecd462d, reapply fix Now that we've backed out the premature push, reapply the actual fix to propagate it appropriately. --- indra/llmessage/tests/llhttpclient_test.cpp | 36 +++++++++++++++++------------ 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/indra/llmessage/tests/llhttpclient_test.cpp b/indra/llmessage/tests/llhttpclient_test.cpp index a2be307cc8..7c3def6024 100644 --- a/indra/llmessage/tests/llhttpclient_test.cpp +++ b/indra/llmessage/tests/llhttpclient_test.cpp @@ -48,7 +48,7 @@ namespace tut { LLSD storage; - + class LLSDStorageNode : public LLHTTPNode { public: @@ -82,8 +82,13 @@ namespace tut { public: HTTPClientTestData(): - local_server(STRINGIZE("http://127.0.0.1:" << getenv("PORT") << "/")) + PORT(getenv("PORT")), + // Turning NULL PORT into empty string doesn't make things work; + // that's just to keep this initializer from blowing up. We test + // PORT separately in the constructor body. + local_server(STRINGIZE("http://127.0.0.1:" << (PORT? PORT : "") << "/")) { + ensure("Set environment variable PORT to local test server port", PORT); apr_pool_create(&mPool, NULL); LLCurl::initClass(false); mServerPump = new LLPumpIO(mPool); @@ -91,7 +96,7 @@ namespace tut LLHTTPClient::setPump(*mClientPump); } - + ~HTTPClientTestData() { delete mServerPump; @@ -107,7 +112,7 @@ namespace tut LLHTTPStandardServices::useServices(); LLHTTPRegistrar::buildAllServices(root); } - + void runThePump(float timeout = 100.0f) { LLTimer timer; @@ -134,6 +139,7 @@ namespace tut mServerPump = NULL; } + const char* const PORT; const std::string local_server; private: @@ -148,11 +154,11 @@ namespace tut { std::string msg = llformat("error() called when not expected, status %d", - mStatus); + mStatus); fail(msg); } } - + void ensureStatusError() { if (!mSawError) @@ -160,7 +166,7 @@ namespace tut fail("error() wasn't called"); } } - + LLSD getResult() { return mResult; @@ -169,7 +175,7 @@ namespace tut { return mHeader; } - + protected: bool mSawError; U32 mStatus; @@ -187,18 +193,18 @@ namespace tut : mClient(client) { } - + public: static Result* build(HTTPClientTestData& client) { return new Result(client); } - + ~Result() { mClient.mResultDeleted = true; } - + virtual void error(U32 status, const std::string& reason) { mClient.mSawError = true; @@ -216,7 +222,7 @@ namespace tut const LLSD& content) { LLHTTPClient::Responder::completed(status, reason, content); - + mClient.mSawCompleted = true; } @@ -244,12 +250,12 @@ namespace tut mResult.clear(); mHeader.clear(); mResultDeleted = false; - + return Result::build(*this); } }; - - + + typedef test_group HTTPClientTestGroup; typedef HTTPClientTestGroup::object HTTPClientTestObject; HTTPClientTestGroup httpClientTestGroup("http_client"); -- cgit v1.2.3 From 4364924ee41d343a03329bb41a725ea815184d2e Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 25 Dec 2012 09:00:42 -0500 Subject: tag merge of DRTVWR-273 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index b1bd7cf117..db4c8f1189 100755 --- a/.hgtags +++ b/.hgtags @@ -385,3 +385,4 @@ daca610d840625b5bebb966a57cb49581852c417 DRTVWR-265 0a2ca6546b499239afeb66d17b2fadbcdbe36ab1 3.4.3-release 84fbaf2d4141bd161731430e760949dc787ca206 DRTVWR-244 083d2d36b5bb1c54fc3dd7caac0e7ac381a9cef0 3.4.4-beta1 +35cfd4cf5b895fa776592f2e630e330be7f0604e DRTVWR-273 -- cgit v1.2.3 From 332eec9b701136407e3311583910bbde9ce43468 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 28 Dec 2012 09:43:51 -0500 Subject: tag merge of DRTVWR-272 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 539dce9104..7612c44c5c 100755 --- a/.hgtags +++ b/.hgtags @@ -388,3 +388,4 @@ daca610d840625b5bebb966a57cb49581852c417 DRTVWR-265 391a8c74cec7275c5d26c85ad108d4782a3e3dd9 DRTVWR-268 b634dec987c16e8c9c938e11e52591d9ead8fa9b DRTVWR-270 cd39255bd23330fd30c04105f2811e941d8524fe 3.4.4-beta2 +a36f1f354b02aa6e448ca13685de167d0a0a3d03 DRTVWR-272 -- cgit v1.2.3 From 55dfff68d4c63918661def881280eae76a63f233 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 2 Jan 2013 10:15:28 -0500 Subject: tag merge of DRTVWR-269 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 57895358e6..817cfef4e2 100755 --- a/.hgtags +++ b/.hgtags @@ -386,3 +386,4 @@ daca610d840625b5bebb966a57cb49581852c417 DRTVWR-265 84fbaf2d4141bd161731430e760949dc787ca206 DRTVWR-244 083d2d36b5bb1c54fc3dd7caac0e7ac381a9cef0 3.4.4-beta1 391a8c74cec7275c5d26c85ad108d4782a3e3dd9 DRTVWR-268 +37dba00ad820de3a808d4039396b162a9c275b3e DRTVWR-269 -- cgit v1.2.3 From 2cba564b24fde367b1ed1d6965e68b5a7da60201 Mon Sep 17 00:00:00 2001 From: Kelly Washington Date: Thu, 3 Jan 2013 09:17:25 -0800 Subject: MAINT-2184 [crashhunters] new crash in LLUUID::toString Fix dangling references. --- indra/llmessage/llavatarnamecache.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index 700525e1fa..a6e2c89ba4 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -348,7 +348,7 @@ void LLAvatarNameCache::requestNamesViaCapability() while(!sAskQueue.empty()) { it = sAskQueue.begin(); - const LLUUID& agent_id = *it; + LLUUID agent_id = *it; sAskQueue.erase(it); if (url.empty()) @@ -416,7 +416,7 @@ void LLAvatarNameCache::requestNamesViaLegacy() for (S32 requests = 0; !sAskQueue.empty() && requests < MAX_REQUESTS; ++requests) { it = sAskQueue.begin(); - const LLUUID& agent_id = *it; + LLUUID agent_id = *it; sAskQueue.erase(it); // Mark as pending first, just in case the callback is immediately @@ -563,8 +563,7 @@ void LLAvatarNameCache::eraseUnrefreshed() const LLAvatarName& av_name = it->second; if (av_name.mExpires < max_unrefreshed) { - const LLUUID& agent_id = it->first; - LL_DEBUGS("AvNameCache") << agent_id + LL_DEBUGS("AvNameCache") << it->first << " user '" << av_name.mUsername << "' " << "expired " << now - av_name.mExpires << " secs ago" << LL_ENDL; -- cgit v1.2.3 From def472b45cb17dd125f802dc3be85450135537a8 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 3 Jan 2013 18:12:29 -0500 Subject: tag merge of DRTVWR-275 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index bac55e793f..25331b4894 100755 --- a/.hgtags +++ b/.hgtags @@ -390,3 +390,4 @@ cd39255bd23330fd30c04105f2811e941d8524fe 3.4.4-beta2 2c4011bbc2b15b82198fd8b51f3a9fe765a08c4d DRTVWR-271 2f8a3ef687bc55828abcb17ac1ad7cde70536d7e 3.4.4-beta3 35cfd4cf5b895fa776592f2e630e330be7f0604e DRTVWR-273 +c374035d459af3c03dea2dd90880dfc25de64706 DRTVWR-275 -- cgit v1.2.3 From fde976cf2bf9740dcd821ad37f0747beaabe34dd Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 4 Jan 2013 14:09:03 -0500 Subject: Added tag 3.4.4-beta4 for changeset 05d9f1dd7a95 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 25331b4894..cde3886212 100755 --- a/.hgtags +++ b/.hgtags @@ -391,3 +391,4 @@ cd39255bd23330fd30c04105f2811e941d8524fe 3.4.4-beta2 2f8a3ef687bc55828abcb17ac1ad7cde70536d7e 3.4.4-beta3 35cfd4cf5b895fa776592f2e630e330be7f0604e DRTVWR-273 c374035d459af3c03dea2dd90880dfc25de64706 DRTVWR-275 +05d9f1dd7a954069af2a33abedb7713fa36a04cb 3.4.4-beta4 -- cgit v1.2.3 From 77abdd04a4a390049c2143e1d87542b9b2a06c86 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 8 Jan 2013 09:34:12 -0500 Subject: tag merge of DRTVWR-250 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 636671b4c9..a627009744 100644 --- a/.hgtags +++ b/.hgtags @@ -368,3 +368,4 @@ f4481df42f9a4a92bf475a80f0c51d1a4bbdfd59 DRTVWR-246 39c5204b6e800983a41ccac8ad6dc993120197c6 DRTVWR-247 7c7d57d393e8ae7b61623279de06eb4a62ccae6a DRTVWR-249 f72b50ef168c159d6e79e97aa2bcafaf8577ab99 DRTVWR-230 +7c6dfdc1b7a2ce0d8e3a8f3ce3058547ea065c0f DRTVWR-250 -- cgit v1.2.3 From b601bc3cbf5e999b4fd0b0b9ae024397b92cce39 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 8 Jan 2013 11:24:33 -0500 Subject: remove duplicated return (merge artifact) --- indra/newview/pipeline.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 62b882adbd..765f2b3a5a 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -863,8 +863,6 @@ LLPipeline::eFBOStatus LLPipeline::doAllocateScreenBuffer(U32 resX, U32 resY) } return ret; - - return ret; } bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) -- cgit v1.2.3