Commits

obscurestar committed 8ec84b4

Fixed several minor issues with validation.

  • Participants
  • Parent commits 655a4b3

Comments (0)

Files changed (6)

indra/mac_updater/AutoUpdater.nib/classes.nib

-{
-IBClasses = ();
-IBVersion = 1;
-}

indra/mac_updater/AutoUpdater.nib/info.nib

-<?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>

indra/mac_updater/AutoUpdater.nib/objects.xib

-<?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&apos;s Owner</string>
-    <reference idRef="1"/>
-    <string>Updater</string>
-    <reference idRef="166"/>
-  </dictionary>
-  <unsigned_int name="nextObjectID">194</unsigned_int>
-</object>

indra/mac_updater/MacUpdaterAppDelegate.mm

     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());
 
 bool isFSRefViewerBundle(const std::string& targetURL)
 {
 	bool result = false;
-    
     NSString *fullPath = [NSString stringWithCString:targetURL.c_str() 
                                             encoding:[NSString defaultCStringEncoding]];
     NSBundle *targetBundle = [NSBundle bundleWithPath:fullPath];
                                             encoding:[NSString defaultCStringEncoding]];
     
     result = [targetBundleStr isEqualToString:sourceBundleStr];
-    
+        
 	if(!result)
     {
         std::cout << "Target bundle ID mismatch." << std::endl;

indra/mac_updater/mac_updater.cpp

 }
 
 //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;
 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 )
 
     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();
     
 	bool replacingTarget = false;
 
-    boost::filesystem::path install_dir;
     boost::filesystem::path app_dir;
     boost::filesystem::path temp_dir;
     boost::filesystem::path mount_dir;
 	try
 	{        
         replacingTarget = getViewerDir( app_dir );
-        install_dir = app_dir.parent_path();
         
         if (!mkTempDir(temp_dir))
         {
         }
        
         //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;
             
 			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 {

indra/mac_updater/mac_updater.h

 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);
 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);