VirtualBox

Changeset 33596 in vbox


Ignore:
Timestamp:
Oct 29, 2010 10:47:07 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
67207
Message:

Main: Change the 'default default' machine folder to '/home/umoeller/VirtualBox VMs'

Location:
trunk/src/VBox/Main
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/MachineImpl.cpp

    r33595 r33596  
    245245/**
    246246 *  Initializes a new machine instance; this init() variant creates a new, empty machine.
    247  *  This gets called from VirtualBox::CreateMachine() or VirtualBox::CreateLegacyMachine().
     247 *  This gets called from VirtualBox::CreateMachine().
    248248 *
    249249 *  @param aParent      Associated parent object
     
    771771
    772772    // uninit media from this machine's media registry, if they're still there
    773     mParent->unregisterMachineMedia(getId());
     773    Guid uuidMachine(getId());
     774    if (!uuidMachine.isEmpty())     // can be empty if we're called from a failure of Machine::init
     775        mParent->unregisterMachineMedia(uuidMachine);
    774776
    775777    /* the lock is no more necessary (SessionMachine is uninitialized) */
  • trunk/src/VBox/Main/MediumImpl.cpp

    r33567 r33596  
    11701170    {
    11711171        strFull = strMachineFolder;
    1172         strFull += RTPATH_DELIMITER;
     1172        strFull += RTPATH_SLASH;
    11731173        strFull += data.strLocation;
    11741174    }
  • trunk/src/VBox/Main/SystemPropertiesImpl.cpp

    r33567 r33596  
    547547    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    548548
    549     m_strDefaultMachineFolderFull.cloneTo(aDefaultMachineFolder);
     549    m->strDefaultMachineFolder.cloneTo(aDefaultMachineFolder);
    550550
    551551    return S_OK;
     
    949949/////////////////////////////////////////////////////////////////////////////
    950950
    951 HRESULT SystemProperties::setDefaultMachineFolder(const Utf8Str &aPath)
    952 {
    953     Utf8Str path(aPath);
    954     if (path.isEmpty())
    955         path = "Machines";
    956 
    957     /* get the full file name */
    958     Utf8Str folder;
    959     int vrc = mParent->calculateFullPath(path, folder);
    960     if (RT_FAILURE(vrc))
    961         return setError(E_FAIL,
    962                         tr("Invalid default machine folder '%s' (%Rrc)"),
    963                         path.c_str(),
    964                         vrc);
     951/**
     952 * Internal implementation to set the default machine folder. Gets called
     953 * from the public attribute setter as well as loadSettings(). With 4.0,
     954 * the "default default" machine folder has changed, and we now require
     955 * a full path always.
     956 * @param aPath
     957 * @return
     958 */
     959HRESULT SystemProperties::setDefaultMachineFolder(const Utf8Str &strPath)
     960{
     961    Utf8Str path(strPath);      // make modifiable
     962    if (    path.isEmpty()          // used by API calls to reset the default
     963         || path == "Machines"      // this value (exactly like this, without path) is stored
     964                                    // in VirtualBox.xml if user upgrades from before 4.0 and
     965                                    // has not changed the default machine folder
     966       )
     967    {
     968        // new default with VirtualBox 4.0: "$HOME/VirtualBox VMs"
     969        char szHome[200]; // RTPATH_MAX is ridiculously large
     970        int vrc = RTPathUserHome(szHome, sizeof(szHome));
     971        if (RT_FAILURE(vrc))
     972            return setError(E_FAIL,
     973                            tr("Cannot determine user home directory (%Rrc)"),
     974                            vrc);
     975
     976        path = szHome;
     977        path += RTPATH_SLASH_STR "VirtualBox VMs";
     978    }
     979
     980    if (!RTPathStartsWithRoot(path.c_str()))
     981        return setError(E_INVALIDARG,
     982                        tr("Given default machine folder '%s' is not fully qualified"),
     983                        path.c_str());
    965984
    966985    m->strDefaultMachineFolder = path;
    967     m_strDefaultMachineFolderFull = folder;
    968986
    969987    return S_OK;
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r33556 r33596  
    72447244      <desc>
    72457245        Full path to the default directory used to create new or open
    7246         existing machines when a settings file name contains no
     7246        existing machines when a machine settings file name contains no
    72477247        path.
    72487248
    7249         The initial value of this property is
    7250         <tt>&lt;</tt><link to="IVirtualBox::homeFolder">
    7251           VirtualBox_home</link><tt>&gt;/Machines</tt>.
    7252 
    7253         <note>
    7254           Setting this property to @c null or an empty string will restore the
    7255           initial value.
    7256         </note>
    7257         <note>
    7258           When settings this property, the specified path can be
    7259           absolute (full path) or relative
    7260           to the <link to="IVirtualBox::homeFolder">
    7261             VirtualBox home directory</link>.
    7262           When reading this property, a full path is
    7263           always returned.
    7264         </note>
    7265         <note>
    7266           The specified path may not exist, it will be created
    7267           when necessary.
    7268         </note>
     7249        Starting with VirtualBox 4.0, by default, this attribute contains
     7250        the full path of folder named "VirtualBox VMs" in the user's
     7251        home directory, which depends on the host platform.
     7252
     7253        When setting this attribute, a full path must be specified.
     7254        Setting this property to @c null or an empty string or the
     7255        special value "Machines" (for compatibility reasons) will restore
     7256        that default value.
     7257
     7258        If the folder specified herein does not exist, it will be created
     7259        automatically as needed.
    72697260
    72707261        <see>
  • trunk/src/VBox/Main/include/SystemPropertiesImpl.h

    r33386 r33596  
    129129    settings::SystemProperties *m;
    130130
    131     Utf8Str             m_strDefaultMachineFolderFull;
    132 
    133131    MediumFormatList    m_llMediumFormats;
    134132
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