| Copyright | Will Thompson and Iñaki García Etxebarria |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria |
| Safe Haskell | None |
| Language | Haskell2010 |
GI.GLib.Structs.Dir
Description
An opaque structure representing an opened directory.
Synopsis
- newtype Dir = Dir (ManagedPtr Dir)
- type family ResolveDirMethod (t :: Symbol) o where ...
- data DirCloseMethodInfo
- dirClose :: (HasCallStack, MonadIO m) => Dir -> m ()
- dirMakeTmp :: (HasCallStack, MonadIO m) => Maybe [Char] -> m [Char]
- dirOpen :: (HasCallStack, MonadIO m) => Text -> Word32 -> m Dir
- data DirReadNameMethodInfo
- dirReadName :: (HasCallStack, MonadIO m) => Dir -> m [Char]
- data DirRefMethodInfo
- dirRef :: (HasCallStack, MonadIO m) => Dir -> m Dir
- data DirRewindMethodInfo
- dirRewind :: (HasCallStack, MonadIO m) => Dir -> m ()
- data DirUnrefMethodInfo
- dirUnref :: (HasCallStack, MonadIO m) => Dir -> m ()
Exported types
Memory-managed wrapper type.
Constructors
| Dir (ManagedPtr Dir) |
Instances
Methods
Click to display all available methods, including inherited ones
type family ResolveDirMethod (t :: Symbol) o where ... Source #
Equations
| ResolveDirMethod "close" o = DirCloseMethodInfo | |
| ResolveDirMethod "readName" o = DirReadNameMethodInfo | |
| ResolveDirMethod "ref" o = DirRefMethodInfo | |
| ResolveDirMethod "rewind" o = DirRewindMethodInfo | |
| ResolveDirMethod "unref" o = DirUnrefMethodInfo | |
| ResolveDirMethod l o = MethodResolutionFailed l o :: Type |
close
data DirCloseMethodInfo Source #
Instances
| (signature ~ m (), MonadIO m) => OverloadedMethod DirCloseMethodInfo Dir signature Source # | |
Defined in GI.GLib.Structs.Dir Methods overloadedMethod :: Dir -> signature # | |
| OverloadedMethodInfo DirCloseMethodInfo Dir Source # | |
Defined in GI.GLib.Structs.Dir Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Dir | |
| -> m () |
Closes the directory immediately and decrements the reference count.
Once the reference count reaches zero, the GDir structure itself will be
freed. Prior to GLib 2.80, GDir was not reference counted.
It is an error to call any of the GDir methods other than
dirRef and dirUnref on a GDir after calling
dirClose on it.
makeTmp
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Maybe [Char] |
|
| -> m [Char] | Returns: The actual name used. This string
should be freed with |
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
open
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Text |
|
| -> Word32 |
|
| -> m Dir | Returns: a newly allocated |
Opens a directory for reading. The names of the files in the
directory can then be retrieved using dirReadName. Note
that the ordering is not defined.
readName
data DirReadNameMethodInfo Source #
Instances
| (signature ~ m [Char], MonadIO m) => OverloadedMethod DirReadNameMethodInfo Dir signature Source # | |
Defined in GI.GLib.Structs.Dir Methods overloadedMethod :: Dir -> signature # | |
| OverloadedMethodInfo DirReadNameMethodInfo Dir Source # | |
Defined in GI.GLib.Structs.Dir Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Dir | |
| -> m [Char] | Returns: The entry's name or |
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.
ref
data DirRefMethodInfo Source #
Instances
| (signature ~ m Dir, MonadIO m) => OverloadedMethod DirRefMethodInfo Dir signature Source # | |
Defined in GI.GLib.Structs.Dir Methods overloadedMethod :: Dir -> signature # | |
| OverloadedMethodInfo DirRefMethodInfo Dir Source # | |
Defined in GI.GLib.Structs.Dir Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Dir |
|
| -> m Dir | Returns: the same pointer as |
Increment the reference count of dir.
Since: 2.80
rewind
data DirRewindMethodInfo Source #
Instances
| (signature ~ m (), MonadIO m) => OverloadedMethod DirRewindMethodInfo Dir signature Source # | |
Defined in GI.GLib.Structs.Dir Methods overloadedMethod :: Dir -> signature # | |
| OverloadedMethodInfo DirRewindMethodInfo Dir Source # | |
Defined in GI.GLib.Structs.Dir Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Dir | |
| -> m () |
Resets the given directory. The next call to dirReadName
will return the first entry again.
unref
data DirUnrefMethodInfo Source #
Instances
| (signature ~ m (), MonadIO m) => OverloadedMethod DirUnrefMethodInfo Dir signature Source # | |
Defined in GI.GLib.Structs.Dir Methods overloadedMethod :: Dir -> signature # | |
| OverloadedMethodInfo DirUnrefMethodInfo Dir Source # | |
Defined in GI.GLib.Structs.Dir Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Dir |
|
| -> m () |
Decrements the reference count of dir.
Once the reference count reaches zero, the directory will be closed and all
resources associated with it will be freed. If dirClose is
called when the reference count is greater than zero, the directory is closed
but the GDir structure will not be freed until its reference count reaches
zero.
It is an error to call any of the GDir methods other than
dirRef and dirUnref on a GDir after calling
dirClose on it.
Since: 2.80