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 (limited to 'indra/mac_updater') 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