diff options
author | Aura Linden <aura@lindenlab.com> | 2012-12-06 21:00:37 -0800 |
---|---|---|
committer | Aura Linden <aura@lindenlab.com> | 2012-12-06 21:00:37 -0800 |
commit | e21275f3562950ae5e5acde8e6f4f631d6c7f1b9 (patch) | |
tree | 7cf220d55f9b0e791288dcafe1eafb6011157041 | |
parent | 9085dc3e84b66e9f3802ebaf23dedb5891c39065 (diff) |
Fixed several minor issues with validation.
-rw-r--r-- | indra/mac_updater/AutoUpdater.nib/classes.nib | 4 | ||||
-rw-r--r-- | indra/mac_updater/AutoUpdater.nib/info.nib | 14 | ||||
-rw-r--r-- | indra/mac_updater/AutoUpdater.nib/objects.xib | 56 | ||||
-rw-r--r-- | indra/mac_updater/MacUpdaterAppDelegate.mm | 5 | ||||
-rw-r--r-- | indra/mac_updater/mac_updater.cpp | 30 | ||||
-rw-r--r-- | indra/mac_updater/mac_updater.h | 4 |
6 files changed, 19 insertions, 94 deletions
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 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>IBDocumentLocation</key> - <string>103 138 356 240 0 0 1280 1002 </string> - <key>IBFramework Version</key> - <string>362.0</string> - <key>IBSystem Version</key> - <string>7D24</string> - <key>targetFramework</key> - <string>IBCarbonFramework</string> -</dict> -</plist> 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 @@ -<?xml version="1.0" standalone="yes"?> -<object class="NSIBObjectData"> - <string name="targetFramework">IBCarbonFramework</string> - <object name="rootObject" class="NSCustomObject" id="1"> - <string name="customClass">NSApplication</string> - </object> - <array count="5" name="allObjects"> - <object class="IBCarbonWindow" id="166"> - <string name="windowRect">405 222 533 663 </string> - <string name="title">Second Life Updater</string> - <object name="rootControl" class="IBCarbonRootControl" id="167"> - <string name="bounds">0 0 128 441 </string> - <array count="3" name="subviews"> - <object class="IBCarbonStaticText" id="181"> - <string name="bounds">20 20 44 421 </string> - <ostype name="controlSignature">what</ostype> - <string name="title">Initializing…</string> - </object> - <object class="IBCarbonButton" id="183"> - <string name="bounds">88 351 108 421 </string> - <string name="title">Cancel</string> - <ostype name="command">not!</ostype> - <int name="buttonType">2</int> - </object> - <object class="IBCarbonProgressBar" id="193"> - <string name="bounds">51 19 70 422 </string> - <ostype name="controlSignature">prog</ostype> - <int name="initialValue">50</int> - </object> - </array> - </object> - <boolean name="isResizable">FALSE</boolean> - <int name="carbonWindowClass">2</int> - <int name="themeBrush">3</int> - <int name="windowPosition">7</int> - </object> - <reference idRef="167"/> - <reference idRef="181"/> - <reference idRef="183"/> - <reference idRef="193"/> - </array> - <array count="5" name="allParents"> - <reference idRef="1"/> - <reference idRef="166"/> - <reference idRef="167"/> - <reference idRef="167"/> - <reference idRef="167"/> - </array> - <dictionary count="2" name="nameTable"> - <string>File's Owner</string> - <reference idRef="1"/> - <string>Updater</string> - <reference idRef="166"/> - </dictionary> - <unsigned_int name="nextObjectID">194</unsigned_int> -</object> 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); |