+ wxString strRoot;
+
+ bool bDoUseGlobal = (style & wxCONFIG_USE_GLOBAL_FILE) != 0;
+
+ // the convention is to put the programs keys under <vendor>\<appname>
+ // (but it can be overriden by specifying the pathes explicitly in strLocal
+ // and/or strGlobal)
+ if ( strLocal.IsEmpty() || (strGlobal.IsEmpty() && bDoUseGlobal) )
+ {
+ if ( vendorName.IsEmpty() )
+ {
+ if ( wxTheApp )
+ strRoot = wxTheApp->GetVendorName();
+ }
+ else
+ {
+ strRoot = vendorName;
+ }
+
+ // no '\\' needed if no vendor name
+ if ( !strRoot.IsEmpty() )
+ {
+ strRoot += '\\';
+ }
+
+ if ( appName.IsEmpty() )
+ {
+ wxCHECK_RET( wxTheApp, "No application name in wxRegConfig ctor!" );
+ strRoot << wxTheApp->GetAppName();
+ }
+ else
+ {
+ strRoot << appName;
+ }
+ }
+ //else: we don't need to do all the complicated stuff above
+
+ wxString str = strLocal.IsEmpty() ? strRoot : strLocal;
+ m_keyLocalRoot.SetName(wxRegKey::HKCU, SOFTWARE_KEY + str);
+ m_keyLocal.SetName(m_keyLocalRoot, "");
+
+ if ( bDoUseGlobal )
+ {
+ str = strGlobal.IsEmpty() ? strRoot : strGlobal;
+ m_keyGlobalRoot.SetName(wxRegKey::HKLM, SOFTWARE_KEY + str);
+ m_keyGlobal.SetName(m_keyGlobalRoot, "");
+ }
+