Merge branch 'default-xdg-config'
Use XDG-compliant location by default in wxFileConfig. See #24195.
This commit is contained in:
commit
d7cff61267
6 changed files with 83 additions and 11 deletions
|
|
@ -28,7 +28,7 @@ enum
|
|||
wxCONFIG_USE_SUBDIR = 16,
|
||||
|
||||
/**
|
||||
Use XDG-compliant file location on Unix systems.
|
||||
Always use XDG-compliant file location on Unix systems.
|
||||
|
||||
If wxCONFIG_USE_SUBDIR is not specified, using this flag has the same
|
||||
effect as calling wxStandardPaths::SetFileLayout() with
|
||||
|
|
@ -38,9 +38,29 @@ enum
|
|||
In combination with wxCONFIG_USE_SUBDIR, this flag changes the default
|
||||
configuration file location to ~/.config/appname/appname.conf`.
|
||||
|
||||
If neither this flag nor wxCONFIG_USE_HOME is specified, XDG-compliant
|
||||
configuration file path will be used by default, but if there is an
|
||||
existing file in the home directory, then it will continue to be used
|
||||
instead.
|
||||
|
||||
@since 3.3.0
|
||||
*/
|
||||
wxCONFIG_USE_XDG = 32
|
||||
wxCONFIG_USE_XDG = 32,
|
||||
|
||||
/**
|
||||
Use home directory for the local file location on Unix systems.
|
||||
|
||||
Using this flag is not recommended, it exists only for compatibility
|
||||
with the previous wxWidgets versions which created configuration files
|
||||
in the home directory (i.e. `~/.appname`) by default.
|
||||
|
||||
Note that any already existing files in the home directory will still
|
||||
be used, even if this file is not specified, unless wxCONFIG_USE_XDG is
|
||||
used.
|
||||
|
||||
@since 3.3.0
|
||||
*/
|
||||
wxCONFIG_USE_HOME = 64
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -90,8 +90,8 @@ public:
|
|||
parameter in the constructor.
|
||||
|
||||
@a style has the same meaning as in @ref wxConfigBase::wxConfigBase "wxConfig constructor"
|
||||
and can contain any combination of styles but only wxCONFIG_USE_SUBDIR
|
||||
and wxCONFIG_USE_XDG are really used by this function.
|
||||
and can contain any combination of styles but only wxCONFIG_USE_SUBDIR,
|
||||
wxCONFIG_USE_XDG and wxCONFIG_USE_HOME are really used by this function.
|
||||
|
||||
Notice that this function cannot be used if @a basename is already a full path name.
|
||||
*/
|
||||
|
|
@ -146,9 +146,8 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
// Note that this must be done after calling MigrateLocalFile(),
|
||||
// otherwise the old style would use XDG layout already and the actual
|
||||
// file at non-XDG-compliant location wouldn't be migrated.
|
||||
// Prefer doing it only after successfully calling MigrateLocalFile(),
|
||||
// otherwise, i.e. if it failed, the old config file wouldn't be used.
|
||||
wxStandardPaths::Get().SetFileLayout(wxStandardPaths::FileLayout_XDG);
|
||||
@endcode
|
||||
|
||||
|
|
@ -157,12 +156,15 @@ public:
|
|||
program, typically including ::wxCONFIG_USE_XDG and possibly also
|
||||
including ::wxCONFIG_USE_SUBDIR.
|
||||
@param oldStyle Style which was used by the previous versions of the
|
||||
program, possibly including ::wxCONFIG_USE_SUBDIR.
|
||||
program, possibly including ::wxCONFIG_USE_SUBDIR and typically
|
||||
including ::wxCONFIG_USE_HOME.
|
||||
|
||||
@since 3.3.0
|
||||
*/
|
||||
static MigrationResult
|
||||
MigrateLocalFile(const wxString& name, int newStyle, int oldStyle = 0);
|
||||
MigrateLocalFile(const wxString& name,
|
||||
int newStyle,
|
||||
int oldStyle = wxCONFIG_USE_HOME);
|
||||
|
||||
/**
|
||||
Saves all config data to the given stream, returns @true if data was saved
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue