wxRuby Documentation Home

# Wx::FileConfig

FileConfig implements ConfigBase interface for
storing and retrieving configuration information using plain text files. The
files have a simple format reminiscent of Windows INI files with lines of the
form `key = value` defining the keys and lines of special form
`$[$group$]$` indicating the start of each group.

This class is used by default for Config on Unix platforms but may also be
used explicitly if you want to use files and not the registry even under
Windows.

## Derived from

ConfigBase

## Methods

- FileConfig.new
- FileConfig#save
- FileConfig#set_umask

### FileConfig.new

FileConfig.new(%(arg-type)InputStream% is, MBConv conv = ConvUTF8)

Read the config data from the specified stream instead of the associated file,
as usual.

#### See also

Save

### FileConfig#save

Boolean save(%(arg-type)OutputStream% os, MBConv conv = ConvUTF8)

Saves all config data to the given stream, returns if data was saved
successfully or on error.

Note the interaction of this function with the internal ``dirty flag’’: the
data is saved unconditionally, i.e. even if the object is not dirty. However
after saving it successfully, the dirty flag is reset so no changes will be
written back to the file this object is associated with until you change its
contents again.

#### See also

Flush

### FileConfig#set_umask

set_umask(%(arg-type)Integer% mode)

Allows to set the mode to be used for the config file creation. For example, to
create a config file which is not readable by other users (useful if it stores
some sensitive information, such as passwords), you could use
`SetUmask(0077)`.

This function doesn’t do anything on non-Unix platforms.

#### See also

CHANGE_UMASK

[This page automatically generated from the Textile source at 2023-06-09 00:45:33 +0000]