gi-glib-2.0.23: GLib bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.GLib.Structs.Dir

Description

An opaque structure representing an opened directory.

Synopsis

Exported types

newtype Dir Source #

Memory-managed wrapper type.

Constructors

Dir (ManagedPtr Dir) 

Instances

Instances details
Eq Dir Source # 
Instance details

Defined in GI.GLib.Structs.Dir

Methods

(==) :: Dir -> Dir -> Bool #

(/=) :: Dir -> Dir -> Bool #

WrappedPtr Dir Source # 
Instance details

Defined in GI.GLib.Structs.Dir

noDir :: Maybe Dir Source #

A convenience alias for Nothing :: Maybe Dir.

Methods

Overloaded methods

close

dirClose Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Dir

dir: a Dir* created by g_dir_open()

-> m () 

Closes the directory and deallocates all related resources.

makeTmp

dirMakeTmp Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Maybe [Char]

tmpl: Template for directory name, as in g_mkdtemp(), basename only, or Nothing for a default template

-> m [Char]

Returns: The actual name used. This string should be freed with free when not needed any longer and is is in the GLib file name encoding. In case of errors, Nothing is returned and error will be set. (Can throw GError)

Creates a subdirectory in the preferred directory for temporary files (as returned by getTmpDir).

tmpl should be a string in the GLib file name encoding containing a sequence of six 'X' characters, as the parameter to g_mkstemp(). However, unlike these functions, the template should only be a basename, no directory components are allowed. If template is Nothing, a default template is used.

Note that in contrast to g_mkdtemp() (and mkdtemp()) tmpl is not modified, and might thus be a read-only literal string.

Since: 2.30

readName

dirReadName Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Dir

dir: a Dir* created by g_dir_open()

-> m [Char]

Returns: The entry's name or Nothing if there are no more entries. The return value is owned by GLib and must not be modified or freed.

Retrieves the name of another entry in the directory, or Nothing. The order of entries returned from this function is not defined, and may vary by file system or other operating-system dependent factors.

Nothing may also be returned in case of errors. On Unix, you can check errno to find out if Nothing was returned because of an error.

On Unix, the '.' and '..' entries are omitted, and the returned name is in the on-disk encoding.

On Windows, as is true of all GLib functions which operate on filenames, the returned name is in UTF-8.

rewind

dirRewind Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Dir

dir: a Dir* created by g_dir_open()

-> m () 

Resets the given directory. The next call to dirReadName will return the first entry again.