VirtualBox

Ticket #302 (new defect)

Opened 7 years ago

Last modified 2 years ago

wrong path for settings under mac os x

Reported by: wolfie Owned by:
Priority: trivial Component: GUI
Version: Keywords: macbeta settings location place
Cc: Guest type: other
Host type: Mac OS X

Description

First of all thank you for porting it to mac os x! It really rocks with WXP and Ubuntu!

But I've noticed that the wrong path has been taken for the settings. It currently uses ~/Library/VirtualBox. This is neither the right place from Apples point of view. Nor would users look in there for their data.

VirtualBox should use instead ~/Library/Application Support/VirtualBox.

:-)

Change History

comment:1 Changed 7 years ago by achimha

You're probably right (remember, we're new to the Mac). However, I noticed that a lot of other applications put their user-specific settings just below ~/Library/ like we do (and that includes Parallels Desktop).

Is there some clear statement from Apple that this is not the right place? If so, we will change it.

comment:2 follow-up: ↓ 3 Changed 7 years ago by achimha

Actually, you are not right.

 http://developer.apple.com/documentation/MacOSX/Conceptual/BPFileSystem/index.html

states about ~/Library/Application Support:

"Contains application-specific data and support files such as third-party plug-ins, helper applications, templates, and extra resources that are used by the application but not required for it to operate. This directory should never contain any kind of user data. By convention, all of these items should be put in a subdirectory named after the application. For example, third-party resources for the application MyApp would go in Application Support/MyApp/. Note that required resources should go inside the application bundle itself."

As we only have settings in ~/Library/VirtualBox, the application support directory clearly isn't the right place.

What we should really do is put our global per-user preferences to ~/Library/Preferences/VirtualBox.xml and then have the individual VM settings reside in ~/Documents/Virtual Machines/<vmname> as bundles (the "Virtual Machines" part is inspired by VMware Fusion). However, this will require some enhancements to the VirtualBox core which we are currently working on (portable VMs, import/export).

comment:3 in reply to: ↑ 2 ; follow-up: ↓ 8 Changed 7 years ago by wolfie

There is a official statement from Apple under  http://developer.apple.com/documentation/MacOSX/Conceptual/BPFileSystem/Articles/LibraryDirectory.html#//apple_ref/doc/uid/20002282-BAJHCHJI

It states that the directory "Application Support" withing the user's library is the appropriate place for "third party" data and support files. The statement seems to be a little confusing.

"Application Support contains application-specific data and support files such as third-party plug-ins, helper applications, templates, and extra resources that are used by the application but not required for it to operate. This directory should never contain any kind of user data." That means the data should not go into this directory *directly*. "By convention, all of these items should be put in a subdirectory named after the application. For example, third-party resources for the application MyApp would go in Application Support/MyApp/." That is what they all do (except Parallels), have a look at the appended files for that.

"Note that required resources should go inside the application bundle itself." That means put data in here, but no program files. Program files go to /Applications/My.app/Contents/.....

Please don't look at the parallels guys! They messed it up.


My Library Folder:

Application Support

Assistants

Audio

Autosave Information

Caches

ColorPickers

Contextual Menu Items

Cookies

Documentation

Favorites

FontCollections

Fonts

Icons

InputManagers

Internet Plug-Ins

Keyboard Layouts

Keychains

Logs

Mail

PreferencePanes

Preferences

Printers

Recent Servers

Safari

Saved Searches

Screen Savers

Scripts

Sounds

Syndication

VirtualBox

Widgets

Workflows

iMovie

iTunes


My Library/Application Support Folder:

AddressBook

BitRocket

Books

Changes Meter

Chess

DVD Player

Deskspace

Download Wizard

ElectricSheep

Firefox

Growl

Little Snitch

Opera

Path Finder

Poisoned

Punakea

Roxio

Smultron

SyncServices

Terminal

Transmission

Vienna

aMule

iCal

iDVD

iTerm

comment:4 Changed 7 years ago by achimha

Your posting just confirms what I just mentioned.

~/Library/Application Support is *not* for settings/preferences/user data. It is definitely not the right directory.

Given that currently, the VirtualBox configuration and the individual VM settings belong together, ~/Library/VirtualBox is the best place.

In the future, there will be ~/Library/Preferences/VirtualBox.xml and each VM will be represented by ~/Documents/<vmname>. It will take some time though as it requires some more fundamental changes in VirtualBox.

comment:5 Changed 7 years ago by wolfie

Stop. Lean back. Stay calm. You stated that you do not have much experience with Macs. Thats why I take the time now to explain Apples statements to you, because I am a actual Mac user.

The answer to our problem is easier than you might think. No rewrite of anything. No mess up with the user space. You can leave everything in *one* directory. Simply move the VirtualBox folder to ~/Library/Application Support/VirtualBox. Trust me :-)

If you don't want to trust, but want to know, read ahead.

Have you seen my directories? (I appended them to my last post.) Do you think any directory of any other long time Mac user would look differently? Don't orientate at multi platform programs like VMware. Their programmers didn't know the Mac as well. Look at real Mac programs instead. They store their binaries and libraries in their Application Bundles (within /Applications) and their data into Application Support/MyApp. :-)

comment:6 Changed 7 years ago by achimha

Reading the Apple documentation clearly shows that Application Support is not the right directory. So we are not going to put configuration data there. Just read the documentation, you will see that you are not right.

Initially, we just checked what other apps do but for every possible mistake, there is at least one popular app that serves as a bad example. So we looked it up in the documentation and it's quite clear there.

comment:7 Changed 7 years ago by wolfie

I didn't want to point out errors our faults. I wanted to help you to make the best VM on earth :-) It was just a hint from me.

Obviously the docs are not as clear as they could. The passage you quoted from the docs is easy to missunderstand. I tried to explain it to you above.

Please read that again.

If you feel anger about the thread, please state yourself Conflict of Interest and hand over the thread to one of your colleages.

comment:8 in reply to: ↑ 3 Changed 7 years ago by wolfie

comment:9 Changed 7 years ago by wolfie

OK, I did some research.

Apple indeed is a bit confusing in their documentation.

But this is a annoying topic since people are usally often frustrated about a folder mess on their systems. Have a look on this to get an impression:  http://blogs.msdn.com/oldnewthing/archive/2006/12/28/1374334.aspx

A good point to ask about the folders is the very polite and helpful Apple Forum "Software Development 101" for new-to-Mac-Developers:  http://discussions.apple.com/forum.jspa?forumID=728

What I did is ask our question there. Read on yourself  http://discussions.apple.com/thread.jspa?threadID=937562

Convinced? Leave everything as it is, but put the folder into /Application Support :-)

comment:10 Changed 7 years ago by achimha

If this is the case, you should ask Apple to correct their documentation. As of now, the official documentation clearly states that configuration settings should not go to "Application Support", only things like plugins and optional modules should go there. A lot of applications (from Apple and third parties) do it that way.

We cannot change the location and then have other people complain that it's wrong citing the Apple documentation. So the current location is the best place until we implement a new split configuration model. This is the opinion of everyone here that is involved in this project.

PS: Note that we are pretty much the only application putting our kernel extension to /Library/Extensions instead of /System/Library/Extensions as recommended by Apple. So we try to be good citizens and respect the system standards.

comment:11 Changed 7 years ago by michael

wolfie: sorry, but if I understood your exchange with Apple (or whoever it was) correctly, they are saying that the configuration data should go into ~/Library/Preferences. I assume that extends to configuration data in XML.

comment:12 Changed 7 years ago by wolfie

Michael,

that is both reality and conform to the guidelines. I checked my Preferences Folder, it consists mostly of XML files with the extension ".plist". All programs store their preferences here into one plist file for every application. Not only Firefox, Opera, amule, bitrocket, but even Parallels have a .plist here. One might say this is a (much easier to maintain) counterpart of the "Registry".

I guess that Apple's XCode provides easy means to maintain such a ".plist." But, to be honest, no user would really care about an application having *no* .plist file in here. Instead people are over and over again upset about applications storing files where they don't belong.

comment:13 Changed 7 years ago by achimha

Our interpretation is that ~/Library/Preferences is intended for .plist files which are managed by the corresponding Carbon API. Our preferences/settings are not in .plist format due to our cross platform nature. Therefore we decided to not make use of the Preferences directory.

comment:14 Changed 7 years ago by wolfie

That is no bad decision. Personally, I would find it too complicated to maintain an extra plist for Mac OS X.

comment:15 Changed 6 years ago by lid

Maybe this warrants a separate ticket, but currently user data is also stored in ~/Library/VirtualBox. In particular, the new virtual disk wizard defaults to this directory, and snapshots are also stored in this directory. According to Apple: Important: You should not store user data files in the Library directory or any of its subdirectories. If your application stores the user’s data automatically—that is, without prompting the user for a location—you should choose a more appropriate location (usually the Documents directory) inside the user’s home directory. For the list of user directories, see “The User Domain.” (From  here.)

I think the snapshots should, by default, be stored together with the virtual disks in ~/Documents/VirtualBox.

comment:16 Changed 6 years ago by frank

  • Host type changed from other to Mac OS X

comment:17 Changed 6 years ago by frank

  • Component changed from other to GUI

comment:18 Changed 6 years ago by virtualbox

being a longtime apple developer i'd like to point out the following:

General Configuration:
~/Library/Preferences/com.sun.virtualbox.plist

Virtual Machines and virtual machine specific config:
~/Library/Application Support/VirtualBox/

other resources (which only change, when you release a new version of virtualbox):
Virtualbox.app/Resources/ (inside the app bundle)

comment:19 Changed 4 years ago by aidan

I was just wondering if there has been any movement on this issue. I think that it would be a huge improvement to move the VirtualBox directory into ~/Library/Application Support. My understanding of the file structure, as derived from Apple's Developer Guidelines and years of using the platform, is that only Apple should be creating directories in ~/Library/, with all application-specific files residing in Application Support/ and Preferences/.

As circumstantial evidence, the only applications that I currently have installed that put themselves directly in Library/ are those that were ported from Unix--all native OS X applications that I have on my system use Application Support/ and Preferences/.

comment:20 Changed 2 years ago by dwt

I would like to add that the default directory for new installs is now ~/VirtualBox which then includes all the virtual machines. I noted this in #9814, but it was closed as a duplicate.

I would like to add to this discussion that it's really annoying if applications hijack my user managed folder hierarchy (be it ~ or ~/Documents) to put stuff in their that I'm not supposed to touch.

If I'm not supposed to touch it, put it in ~/Library, to spare me the annoyance of having to look at it all day and being remembered that 'yes I shouldn't touch it', but I still have to scroll over it and navigate to it by accident and remember that I have to exclude it from my backups etc...)

Note: See TracTickets for help on using tickets.

www.oracle.com
ContactPrivacy policyTerms of Use