Forbid creation of wxStandardPaths object directly.
This happens to work under MSW and Unix where there is only one wxStandardPaths class for both the console and the GUI applications but doesn't return the correct result under OS X where the Core Foundation version, returned by wxStandardPaths::Get(), has to be used for the GUI programs. And historically this confused a lot of people, so just ensure that they can't accidentally create an object of the wrong type any more. Closes #13537. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74428 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -19,10 +19,6 @@
|
||||
class WXDLLIMPEXP_BASE wxStandardPaths : public wxStandardPathsBase
|
||||
{
|
||||
public:
|
||||
// ctor calls IgnoreAppBuildSubDirs() and also sets up the object to use
|
||||
// both vendor and application name by default
|
||||
wxStandardPaths();
|
||||
|
||||
// implement base class pure virtuals
|
||||
virtual wxString GetExecutablePath() const;
|
||||
virtual wxString GetConfigDir() const;
|
||||
@@ -67,6 +63,13 @@ public:
|
||||
static wxString MSWGetShellDir(int csidl);
|
||||
|
||||
protected:
|
||||
// Ctor is protected, use wxStandardPaths::Get() instead of instantiating
|
||||
// objects of this class directly.
|
||||
//
|
||||
// It calls IgnoreAppBuildSubDirs() and also sets up the object to use
|
||||
// both vendor and application name by default.
|
||||
wxStandardPaths();
|
||||
|
||||
// get the path corresponding to the given standard CSIDL_XXX constant
|
||||
static wxString DoGetDirectory(int csidl);
|
||||
|
||||
|
@@ -40,6 +40,11 @@ public:
|
||||
virtual wxString GetUserDataDir() const;
|
||||
virtual wxString GetPluginsDir() const;
|
||||
|
||||
protected:
|
||||
// Ctor is protected, use wxStandardPaths::Get() instead of instantiating
|
||||
// objects of this class directly.
|
||||
wxStandardPaths() { }
|
||||
|
||||
private:
|
||||
static wxString m_prefix;
|
||||
};
|
||||
|
@@ -35,7 +35,6 @@ typedef __CFBundle * wxCFBundleRef;
|
||||
class WXDLLIMPEXP_BASE wxStandardPathsCF : public wxStandardPathsCFBase
|
||||
{
|
||||
public:
|
||||
wxStandardPathsCF();
|
||||
virtual ~wxStandardPathsCF();
|
||||
|
||||
// wxMac specific: allow user to specify a different bundle
|
||||
@@ -57,6 +56,10 @@ public:
|
||||
virtual wxString GetDocumentsDir() const;
|
||||
|
||||
protected:
|
||||
// Ctor is protected, use wxStandardPaths::Get() instead of instantiating
|
||||
// objects of this class directly.
|
||||
wxStandardPathsCF();
|
||||
|
||||
// this function can be called with any of CFBundleCopyXXXURL function
|
||||
// pointer as parameter
|
||||
wxString GetFromFunc(wxCFURLRef (*func)(wxCFBundleRef)) const;
|
||||
|
@@ -142,9 +142,6 @@ public:
|
||||
virtual wxString GetTempDir() const;
|
||||
|
||||
|
||||
// ctor for the base class
|
||||
wxStandardPathsBase();
|
||||
|
||||
// virtual dtor for the base class
|
||||
virtual ~wxStandardPathsBase();
|
||||
|
||||
@@ -158,6 +155,10 @@ public:
|
||||
|
||||
|
||||
protected:
|
||||
// Ctor is protected as this is a base class which should never be created
|
||||
// directly.
|
||||
wxStandardPathsBase();
|
||||
|
||||
// append the path component, with a leading path separator if a
|
||||
// path separator or dot (.) is not already at the end of dir
|
||||
static wxString AppendPathComponent(const wxString& dir, const wxString& component);
|
||||
@@ -210,6 +211,12 @@ public:
|
||||
virtual wxString GetPluginsDir() const { return m_prefix; }
|
||||
virtual wxString GetDocumentsDir() const { return m_prefix; }
|
||||
|
||||
protected:
|
||||
// Ctor is protected because wxStandardPaths::Get() should always be used
|
||||
// to access the global wxStandardPaths object of the correct type instead
|
||||
// of creating one of a possibly wrong type yourself.
|
||||
wxStandardPaths() { }
|
||||
|
||||
private:
|
||||
wxString m_prefix;
|
||||
};
|
||||
|
@@ -51,6 +51,11 @@ public:
|
||||
virtual wxString GetDocumentsDir() const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
// Ctor is protected, use wxStandardPaths::Get() instead of instantiating
|
||||
// objects of this class directly.
|
||||
wxStandardPaths() { }
|
||||
|
||||
private:
|
||||
wxString m_prefix;
|
||||
};
|
||||
|
Reference in New Issue
Block a user