VirtualBox

Changeset 23808 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Oct 15, 2009 3:57:30 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
53550
Message:

API/Settings: fix writing old settings files (empty attachments were written)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/xml/Settings.cpp

    r23803 r23808  
    27412741            const AttachedDevice &att = *it2;
    27422742
     2743            /* DVD/Floppy is handled already for settings version before 1.8 */
     2744            if (    att.deviceType == DeviceType_DVD
     2745                &&  m->sv <= SettingsVersion_v1_8)
     2746                continue;
     2747
    27432748            xml::ElementNode *pelmDevice = pelmController->createChild("AttachedDevice");
    27442749
     
    27512756                break;
    27522757
    2753                 case DeviceType_DVD:            // settings format 1.9
    2754                     if (m->sv >= SettingsVersion_v1_9)
    2755                     {
    2756                         pcszType = "DVD";
    2757                         if (att.fPassThrough)
    2758                             pelmDevice->setAttribute("passthrough", att.fPassThrough);
    2759                     }
     2758                case DeviceType_DVD:
     2759                    pcszType = "DVD";
     2760                    if (att.fPassThrough)
     2761                        pelmDevice->setAttribute("passthrough", att.fPassThrough);
    27602762                break;
    27612763
    27622764                case DeviceType_Floppy:
    2763                     if (m->sv >= SettingsVersion_v1_9)
    2764                         pcszType = "Floppy";
     2765                    pcszType = "Floppy";
    27652766                break;
    27662767            }
    27672768
    2768             if (pcszType)       // can be NULL for pre-1.9 settings that shouldn't be written here
    2769             {
    2770                 pelmDevice->setAttribute("type", pcszType);
    2771 
    2772                 pelmDevice->setAttribute("port", att.lPort);
    2773                 pelmDevice->setAttribute("device", att.lDevice);
    2774 
    2775                 if (!att.uuid.isEmpty())
    2776                     pelmDevice->createChild("Image")->setAttribute("uuid", makeString(att.uuid));
    2777                 else if (    (m->sv >= SettingsVersion_v1_9)
    2778                           && (att.strHostDriveSrc.length())
    2779                         )
    2780                     pelmDevice->createChild("HostDrive")->setAttribute("src", att.strHostDriveSrc);
    2781             }
     2769            pelmDevice->setAttribute("type", pcszType);
     2770
     2771            pelmDevice->setAttribute("port", att.lPort);
     2772            pelmDevice->setAttribute("device", att.lDevice);
     2773
     2774            if (!att.uuid.isEmpty())
     2775                pelmDevice->createChild("Image")->setAttribute("uuid", makeString(att.uuid));
     2776            else if (    (m->sv >= SettingsVersion_v1_9)
     2777                      && (att.strHostDriveSrc.length())
     2778                    )
     2779                pelmDevice->createChild("HostDrive")->setAttribute("src", att.strHostDriveSrc);
    27822780        }
    27832781    }
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette