You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tqt3/doc/html/ntqdir.html

819 lines
51 KiB

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/tools/qdir.cpp:56 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQDir Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
<a href="index.html">
<font color="#004faf">Home</font></a>
| <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
| <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQDir Class Reference</h1>
<p>The TQDir class provides access to directory structures and their contents in a platform-independent way.
<a href="#details">More...</a>
<p>All the functions in this class are <a href="threads.html#reentrant">reentrant</a> when TQt is built with thread support.</p>
<p><tt>#include &lt;<a href="qdir-h.html">ntqdir.h</a>&gt;</tt>
<p><a href="qdir-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn>enum <a href="#FilterSpec-enum"><b>FilterSpec</b></a> { Dirs = 0x001, Files = 0x002, Drives = 0x004, NoSymLinks = 0x008, All = 0x007, TypeMask = 0x00F, Readable = 0x010, Writable = 0x020, Executable = 0x040, RWEMask = 0x070, Modified = 0x080, Hidden = 0x100, System = 0x200, AccessMask = 0x3F0, DefaultFilter = -1 }</li>
<li class=fn>enum <a href="#SortSpec-enum"><b>SortSpec</b></a> { Name = 0x00, Time = 0x01, Size = 0x02, Unsorted = 0x03, SortByMask = 0x03, DirsFirst = 0x04, Reversed = 0x08, IgnoreCase = 0x10, LocaleAware = 0x20, DefaultSort = -1 }</li>
<li class=fn><a href="#TQDir"><b>TQDir</b></a> ()</li>
<li class=fn><a href="#TQDir-2"><b>TQDir</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;path, const&nbsp;TQString&nbsp;&amp;&nbsp;nameFilter = TQString::null, int&nbsp;sortSpec = Name | IgnoreCase, int&nbsp;filterSpec = All )</li>
<li class=fn><a href="#TQDir-3"><b>TQDir</b></a> ( const&nbsp;TQDir&nbsp;&amp;&nbsp;d )</li>
<li class=fn>virtual <a href="#~TQDir"><b>~TQDir</b></a> ()</li>
<li class=fn>TQDir &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;TQDir&nbsp;&amp;&nbsp;d )</li>
<li class=fn>TQDir &amp; <a href="#operator-eq-2"><b>operator=</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;path )</li>
<li class=fn>virtual void <a href="#setPath"><b>setPath</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;path )</li>
<li class=fn>virtual TQString <a href="#path"><b>path</b></a> () const</li>
<li class=fn>virtual TQString <a href="#absPath"><b>absPath</b></a> () const</li>
<li class=fn>virtual TQString <a href="#canonicalPath"><b>canonicalPath</b></a> () const</li>
<li class=fn>virtual TQString <a href="#dirName"><b>dirName</b></a> () const</li>
<li class=fn>virtual TQString <a href="#filePath"><b>filePath</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;fileName, bool&nbsp;acceptAbsPath = TRUE ) const</li>
<li class=fn>virtual TQString <a href="#absFilePath"><b>absFilePath</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;fileName, bool&nbsp;acceptAbsPath = TRUE ) const</li>
<li class=fn>virtual bool <a href="#cd"><b>cd</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;dirName, bool&nbsp;acceptAbsPath = TRUE )</li>
<li class=fn>virtual bool <a href="#cdUp"><b>cdUp</b></a> ()</li>
<li class=fn>TQString <a href="#nameFilter"><b>nameFilter</b></a> () const</li>
<li class=fn>virtual void <a href="#setNameFilter"><b>setNameFilter</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;nameFilter )</li>
<li class=fn>FilterSpec <a href="#filter"><b>filter</b></a> () const</li>
<li class=fn>virtual void <a href="#setFilter"><b>setFilter</b></a> ( int&nbsp;filterSpec )</li>
<li class=fn>SortSpec <a href="#sorting"><b>sorting</b></a> () const</li>
<li class=fn>virtual void <a href="#setSorting"><b>setSorting</b></a> ( int&nbsp;sortSpec )</li>
<li class=fn>bool <a href="#matchAllDirs"><b>matchAllDirs</b></a> () const</li>
<li class=fn>virtual void <a href="#setMatchAllDirs"><b>setMatchAllDirs</b></a> ( bool&nbsp;enable )</li>
<li class=fn>uint <a href="#count"><b>count</b></a> () const</li>
<li class=fn>TQString <a href="#operator[]"><b>operator[]</b></a> ( int&nbsp;index ) const</li>
<li class=fn>virtual TQStrList encodedEntryList ( int&nbsp;filterSpec = DefaultFilter, int&nbsp;sortSpec = DefaultSort ) const &nbsp;<em>(obsolete)</em></li>
<li class=fn>virtual TQStrList encodedEntryList ( const&nbsp;TQString&nbsp;&amp;&nbsp;nameFilter, int&nbsp;filterSpec = DefaultFilter, int&nbsp;sortSpec = DefaultSort ) const &nbsp;<em>(obsolete)</em></li>
<li class=fn>virtual TQStringList <a href="#entryList-2"><b>entryList</b></a> ( int&nbsp;filterSpec = DefaultFilter, int&nbsp;sortSpec = DefaultSort ) const</li>
<li class=fn>virtual TQStringList <a href="#entryList"><b>entryList</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;nameFilter, int&nbsp;filterSpec = DefaultFilter, int&nbsp;sortSpec = DefaultSort ) const</li>
<li class=fn>virtual const TQFileInfoList * <a href="#entryInfoList-2"><b>entryInfoList</b></a> ( int&nbsp;filterSpec = DefaultFilter, int&nbsp;sortSpec = DefaultSort ) const</li>
<li class=fn>virtual const TQFileInfoList * <a href="#entryInfoList"><b>entryInfoList</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;nameFilter, int&nbsp;filterSpec = DefaultFilter, int&nbsp;sortSpec = DefaultSort ) const</li>
<li class=fn>virtual bool <a href="#mkdir"><b>mkdir</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;dirName, bool&nbsp;acceptAbsPath = TRUE ) const</li>
<li class=fn>virtual bool <a href="#rmdir"><b>rmdir</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;dirName, bool&nbsp;acceptAbsPath = TRUE ) const</li>
<li class=fn>virtual bool <a href="#isReadable"><b>isReadable</b></a> () const</li>
<li class=fn>virtual bool <a href="#exists-2"><b>exists</b></a> () const</li>
<li class=fn>virtual bool <a href="#isRoot"><b>isRoot</b></a> () const</li>
<li class=fn>virtual bool <a href="#isRelative"><b>isRelative</b></a> () const</li>
<li class=fn>virtual void <a href="#convertToAbs"><b>convertToAbs</b></a> ()</li>
<li class=fn>virtual bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const&nbsp;TQDir&nbsp;&amp;&nbsp;d ) const</li>
<li class=fn>virtual bool <a href="#operator!-eq"><b>operator!=</b></a> ( const&nbsp;TQDir&nbsp;&amp;&nbsp;d ) const</li>
<li class=fn>virtual bool <a href="#remove"><b>remove</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;fileName, bool&nbsp;acceptAbsPath = TRUE )</li>
<li class=fn>virtual bool <a href="#rename"><b>rename</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;oldName, const&nbsp;TQString&nbsp;&amp;&nbsp;newName, bool&nbsp;acceptAbsPaths = TRUE )</li>
<li class=fn>virtual bool <a href="#exists"><b>exists</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;name, bool&nbsp;acceptAbsPath = TRUE )</li>
<li class=fn>void <a href="#refresh"><b>refresh</b></a> () const</li>
</ul>
<h2>Static Public Members</h2>
<ul>
<li class=fn>TQString <a href="#convertSeparators"><b>convertSeparators</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;pathName )</li>
<li class=fn>const TQFileInfoList * <a href="#drives"><b>drives</b></a> ()</li>
<li class=fn>char <a href="#separator"><b>separator</b></a> ()</li>
<li class=fn>bool <a href="#setCurrent"><b>setCurrent</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;path )</li>
<li class=fn>TQDir <a href="#current"><b>current</b></a> ()</li>
<li class=fn>TQDir <a href="#home"><b>home</b></a> ()</li>
<li class=fn>TQDir <a href="#root"><b>root</b></a> ()</li>
<li class=fn>TQString <a href="#currentDirPath"><b>currentDirPath</b></a> ()</li>
<li class=fn>TQString <a href="#homeDirPath"><b>homeDirPath</b></a> ()</li>
<li class=fn>TQString <a href="#rootDirPath"><b>rootDirPath</b></a> ()</li>
<li class=fn>bool <a href="#match-2"><b>match</b></a> ( const&nbsp;TQStringList&nbsp;&amp;&nbsp;filters, const&nbsp;TQString&nbsp;&amp;&nbsp;fileName )</li>
<li class=fn>bool <a href="#match"><b>match</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;filter, const&nbsp;TQString&nbsp;&amp;&nbsp;fileName )</li>
<li class=fn>TQString <a href="#cleanDirPath"><b>cleanDirPath</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;filePath )</li>
<li class=fn>bool <a href="#isRelativePath"><b>isRelativePath</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;path )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The TQDir class provides access to directory structures and their contents in a platform-independent way.
<p>
<p> A TQDir is used to manipulate path names, access information
regarding paths and files, and manipulate the underlying file
system.
<p> A TQDir can point to a file using either a relative or an absolute
path. Absolute paths begin with the directory separator "/"
(optionally preceded by a drive specification under Windows). If
you always use "/" as a directory separator, TQt will translate
your paths to conform to the underlying operating system. Relative
file names begin with a directory name or a file name and specify
a path relative to the current directory.
<p> The "current" path refers to the application's working directory.
A TQDir's own path is set and retrieved with <a href="#setPath">setPath</a>() and <a href="#path">path</a>().
<p> An example of an absolute path is the string "/tmp/quartz", a
relative path might look like "src/fatlib". You can use the
function <a href="#isRelative">isRelative</a>() to check if a TQDir is using a relative or an
absolute file path. Call <a href="#convertToAbs">convertToAbs</a>() to convert a relative TQDir
to an absolute one. For a simplified path use <a href="#cleanDirPath">cleanDirPath</a>(). To
obtain a path which has no symbolic links or redundant ".."
elements use <a href="#canonicalPath">canonicalPath</a>(). The path can be set with setPath(),
and changed with <a href="#cd">cd</a>() and <a href="#cdUp">cdUp</a>().
<p> TQDir provides several static functions, for example, <a href="#setCurrent">setCurrent</a>()
to set the application's working directory and <a href="#currentDirPath">currentDirPath</a>() to
retrieve the application's working directory. Access to some
common paths is provided with the static functions, <a href="#current">current</a>(),
<a href="#home">home</a>() and <a href="#root">root</a>() which return TQDir objects or currentDirPath(),
<a href="#homeDirPath">homeDirPath</a>() and <a href="#rootDirPath">rootDirPath</a>() which return the path as a string.
If you want to know about your application's path use
<a href="ntqapplication.html#applicationDirPath">TQApplication::applicationDirPath</a>().
<p> The number of entries in a directory is returned by <a href="#count">count</a>().
Obtain a string list of the names of all the files and directories
in a directory with <a href="#entryList">entryList</a>(). If you prefer a list of <a href="ntqfileinfo.html">TQFileInfo</a>
pointers use <a href="#entryInfoList">entryInfoList</a>(). Both these functions can apply a
name filter, an attributes filter (e.g. read-only, files not
directories, etc.), and a sort order. The filters and sort may be
set with calls to <a href="#setNameFilter">setNameFilter</a>(), <a href="#setFilter">setFilter</a>() and <a href="#setSorting">setSorting</a>().
They may also be specified in the entryList() and
entryInfoList()'s arguments.
<p> Create a new directory with <a href="#mkdir">mkdir</a>(), rename a directory with
<a href="#rename">rename</a>() and remove an existing directory with <a href="#rmdir">rmdir</a>(). Remove a
file with <a href="#remove">remove</a>(). You can interrogate a directory with <a href="#exists">exists</a>(),
<a href="#isReadable">isReadable</a>() and <a href="#isRoot">isRoot</a>().
<p> To get a path with a filename use <a href="#filePath">filePath</a>(), and to get a
directory name use <a href="#dirName">dirName</a>(); neither of these functions checks
for the existence of the file or directory.
<p> The list of root directories is provided by <a href="#drives">drives</a>(); on Unix
systems this returns a list containing one root directory, "/"; on
Windows the list will usually contain "C:/", and possibly "D:/",
etc.
<p> It is easiest to work with "/" separators in TQt code. If you need
to present a path to the user or need a path in a form suitable
for a function in the underlying operating system use
<a href="#convertSeparators">convertSeparators</a>().
<p> Examples:
<p> See if a directory exists.
<pre>
TQDir d( "example" ); // "./example"
if ( !d.<a href="#exists">exists</a>() )
<a href="ntqapplication.html#qWarning">tqWarning</a>( "Cannot find the example directory" );
</pre>
<p> Traversing directories and reading a file.
<pre>
TQDir d = TQDir::<a href="#root">root</a>(); // "/"
if ( !d.<a href="#cd">cd</a>("tmp") ) { // "/tmp"
<a href="ntqapplication.html#qWarning">tqWarning</a>( "Cannot find the \"/tmp\" directory" );
} else {
<a href="ntqfile.html">TQFile</a> f( d.<a href="#filePath">filePath</a>("ex1.txt") ); // "/tmp/ex1.txt"
if ( !f.<a href="ntqfile.html#open">open</a>(IO_ReadWrite) )
<a href="ntqapplication.html#qWarning">tqWarning</a>( "Cannot create the file %s", f.<a href="ntqfile.html#name">name</a>() );
}
</pre>
<p> A program that lists all the files in the current directory
(excluding symbolic links), sorted by size, smallest first:
<pre>
#include &lt;stdio.h&gt;
#include &lt;<a href="qdir-h.html">ntqdir.h</a>&gt;
int main( int argc, char **argv )
{
TQDir d;
d.<a href="#setFilter">setFilter</a>( TQDir::<a href="#FilterSpec-enum">Files</a> | TQDir::<a href="#FilterSpec-enum">Hidden</a> | TQDir::<a href="#FilterSpec-enum">NoSymLinks</a> );
d.<a href="#setSorting">setSorting</a>( TQDir::<a href="#SortSpec-enum">Size</a> | TQDir::<a href="#SortSpec-enum">Reversed</a> );
const TQFileInfoList *list = d.<a href="#entryInfoList">entryInfoList</a>();
TQFileInfoListIterator it( *list );
<a href="ntqfileinfo.html">TQFileInfo</a> *fi;
printf( " Bytes Filename\n" );
while ( (fi = it.current()) != 0 ) {
printf( "%10li %s\n", fi-&gt;<a href="ntqfileinfo.html#size">size</a>(), fi-&gt;<a href="ntqfileinfo.html#fileName">fileName</a>().latin1() );
++it;
}
return 0;
}
</pre>
<p> <p>See also <a href="ntqapplication.html#applicationDirPath">TQApplication::applicationDirPath</a>() and <a href="io.html">Input/Output and Networking</a>.
<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="FilterSpec-enum"></a>TQDir::FilterSpec</h3>
<p> This enum describes the filtering options available to TQDir, e.g.
for <a href="#entryList">entryList</a>() and <a href="#entryInfoList">entryInfoList</a>(). The filter value is specified
by OR-ing together values from the following list:
<ul>
<li><tt>TQDir::Dirs</tt> - List directories only.
<li><tt>TQDir::Files</tt> - List files only.
<li><tt>TQDir::Drives</tt> - List disk drives (ignored under Unix).
<li><tt>TQDir::NoSymLinks</tt> - Do not list symbolic links (ignored by operating
systems that don't support symbolic links).
<li><tt>TQDir::All</tt> - List directories, files, drives and symlinks (this does not list
broken symlinks unless you specify System).
<li><tt>TQDir::TypeMask</tt> - A mask for the the Dirs, Files, Drives and
NoSymLinks flags.
<li><tt>TQDir::Readable</tt> - List files for which the application has read access.
<li><tt>TQDir::Writable</tt> - List files for which the application has write access.
<li><tt>TQDir::Executable</tt> - List files for which the application has execute
access. Executables needs to be combined with Dirs or Files.
<li><tt>TQDir::RWEMask</tt> - A mask for the Readable, Writable and Executable flags.
<li><tt>TQDir::Modified</tt> - Only list files that have been modified (ignored
under Unix).
<li><tt>TQDir::Hidden</tt> - List hidden files (on Unix, files starting with a .).
<li><tt>TQDir::System</tt> - List system files (on Unix, FIFOs, sockets and
device files)
<li><tt>TQDir::AccessMask</tt> - A mask for the Readable, Writable, Executable
Modified, Hidden and System flags
<li><tt>TQDir::DefaultFilter</tt> - Internal flag.
</ul><p> If you do not set any of <a href="#FilterSpec-enum">Readable</a>, <a href="#FilterSpec-enum">Writable</a> or <a href="#FilterSpec-enum">Executable</a>, TQDir will set all three of them. This makes the
default easy to write and at the same time useful.
<p> Examples: <tt>Readable|Writable</tt> means list all files for which the
application has read access, write access or both. <tt>Dirs|Drives</tt>
means list drives, directories, all files that the application can
read, write or execute, and also symlinks to such
files/directories.
<h3 class=fn><a name="SortSpec-enum"></a>TQDir::SortSpec</h3>
<p> This enum describes the sort options available to TQDir, e.g. for
<a href="#entryList">entryList</a>() and <a href="#entryInfoList">entryInfoList</a>(). The sort value is specified by
OR-ing together values from the following list:
<ul>
<li><tt>TQDir::Name</tt> - Sort by name.
<li><tt>TQDir::Time</tt> - Sort by time (modification time).
<li><tt>TQDir::Size</tt> - Sort by file size.
<li><tt>TQDir::Unsorted</tt> - Do not sort.
<li><tt>TQDir::SortByMask</tt> - A mask for Name, Time and Size.
<li><tt>TQDir::DirsFirst</tt> - Put the directories first, then the files.
<li><tt>TQDir::Reversed</tt> - Reverse the sort order.
<li><tt>TQDir::IgnoreCase</tt> - Sort case-insensitively.
<li><tt>TQDir::LocaleAware</tt> - Sort names using locale aware compares
<li><tt>TQDir::DefaultSort</tt> - Internal flag.
</ul><p> You can only specify one of the first four.
<p> If you specify both <a href="#SortSpec-enum">DirsFirst</a> and <a href="#SortSpec-enum">Reversed</a>, directories are
still put first, but in reverse order; the files will be listed
after the directories, again in reverse order.
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQDir"></a>TQDir::TQDir ()
</h3>
Constructs a TQDir pointing to the current directory (".").
<p> <p>See also <a href="#currentDirPath">currentDirPath</a>().
<h3 class=fn><a name="TQDir-2"></a>TQDir::TQDir ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;path, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;nameFilter = TQString::null, int&nbsp;sortSpec = Name | IgnoreCase, int&nbsp;filterSpec = All )
</h3>
Constructs a TQDir with path <em>path</em>, that filters its entries by
name using <em>nameFilter</em> and by attributes using <em>filterSpec</em>. It
also sorts the names using <em>sortSpec</em>.
<p> The default <em>nameFilter</em> is an empty string, which excludes
nothing; the default <em>filterSpec</em> is <a href="#FilterSpec-enum">All</a>, which also means
exclude nothing. The default <em>sortSpec</em> is <tt>Name|IgnoreCase</tt>,
i.e. sort by name case-insensitively.
<p> Example that lists all the files in "/tmp":
<pre>
TQDir d( "/tmp" );
for ( int i = 0; i &lt; d.<a href="#count">count</a>(); i++ )
printf( "%s\n", d[i] );
</pre>
<p> If <em>path</em> is "" or <a href="ntqstring.html#TQString-null">TQString::null</a>, TQDir uses "." (the current
directory). If <em>nameFilter</em> is "" or TQString::null, TQDir uses the
name filter "*" (all files).
<p> Note that <em>path</em> need not exist.
<p> <p>See also <a href="#exists">exists</a>(), <a href="#setPath">setPath</a>(), <a href="#setNameFilter">setNameFilter</a>(), <a href="#setFilter">setFilter</a>(), and <a href="#setSorting">setSorting</a>().
<h3 class=fn><a name="TQDir-3"></a>TQDir::TQDir ( const&nbsp;<a href="ntqdir.html">TQDir</a>&nbsp;&amp;&nbsp;d )
</h3>
Constructs a TQDir that is a copy of the directory <em>d</em>.
<p> <p>See also <a href="#operator-eq">operator=</a>().
<h3 class=fn><a name="~TQDir"></a>TQDir::~TQDir ()<tt> [virtual]</tt>
</h3>
Destroys the TQDir frees up its resources.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="absFilePath"></a>TQDir::absFilePath ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;fileName, bool&nbsp;acceptAbsPath = TRUE ) const<tt> [virtual]</tt>
</h3>
Returns the absolute path name of a file in the directory. Does <em>not</em> check if the file actually exists in the directory. Redundant
multiple separators or "." and ".." directories in <em>fileName</em>
will not be removed (see <a href="#cleanDirPath">cleanDirPath</a>()).
<p> If <em>acceptAbsPath</em> is TRUE a <em>fileName</em> starting with a
separator "/" will be returned without change. If <em>acceptAbsPath</em>
is FALSE an absolute path will be prepended to the fileName and
the resultant string returned.
<p> <p>See also <a href="#filePath">filePath</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="absPath"></a>TQDir::absPath () const<tt> [virtual]</tt>
</h3>
Returns the absolute path (a path that starts with "/" or with a
drive specification), which may contain symbolic links, but never
contains redundant ".", ".." or multiple separators.
<p> <p>See also <a href="#setPath">setPath</a>(), <a href="#canonicalPath">canonicalPath</a>(), <a href="#exists">exists</a>(), <a href="#cleanDirPath">cleanDirPath</a>(), <a href="#dirName">dirName</a>(), and <a href="#absFilePath">absFilePath</a>().
<p>Example: <a href="fileiconview-example.html#x810">fileiconview/qfileiconview.cpp</a>.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="canonicalPath"></a>TQDir::canonicalPath () const<tt> [virtual]</tt>
</h3>
Returns the canonical path, i.e. a path without symbolic links or
redundant "." or ".." elements.
<p> On systems that do not have symbolic links this function will
always return the same string that <a href="#absPath">absPath</a>() returns. If the
canonical path does not exist (normally due to dangling symbolic
links) <a href="#canonicalPath">canonicalPath</a>() returns <a href="ntqstring.html#TQString-null">TQString::null</a>.
<p> <p>See also <a href="#path">path</a>(), <a href="#absPath">absPath</a>(), <a href="#exists">exists</a>(), <a href="#cleanDirPath">cleanDirPath</a>(), <a href="#dirName">dirName</a>(), <a href="#absFilePath">absFilePath</a>(), and <a href="ntqstring.html#isNull">TQString::isNull</a>().
<h3 class=fn>bool <a name="cd"></a>TQDir::cd ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;dirName, bool&nbsp;acceptAbsPath = TRUE )<tt> [virtual]</tt>
</h3>
Changes the TQDir's directory to <em>dirName</em>.
<p> If <em>acceptAbsPath</em> is TRUE a path starting with separator "/"
will cause the function to change to the absolute directory. If <em>acceptAbsPath</em> is FALSE any number of separators at the beginning
of <em>dirName</em> will be removed and the function will descend into
<em>dirName</em>.
<p> Returns TRUE if the new directory exists and is readable;
otherwise returns FALSE. Note that the logical <a href="#cd">cd</a>() operation is
not performed if the new directory does not exist.
<p> Calling cd( ".." ) is equivalent to calling <a href="#cdUp">cdUp</a>().
<p> <p>See also <a href="#cdUp">cdUp</a>(), <a href="#isReadable">isReadable</a>(), <a href="#exists">exists</a>(), and <a href="#path">path</a>().
<p>Example: <a href="fileiconview-example.html#x883">fileiconview/mainwindow.cpp</a>.
<h3 class=fn>bool <a name="cdUp"></a>TQDir::cdUp ()<tt> [virtual]</tt>
</h3>
Changes directory by moving one directory up from the TQDir's
current directory.
<p> Returns TRUE if the new directory exists and is readable;
otherwise returns FALSE. Note that the logical <a href="#cdUp">cdUp</a>() operation is
not performed if the new directory does not exist.
<p> <p>See also <a href="#cd">cd</a>(), <a href="#isReadable">isReadable</a>(), <a href="#exists">exists</a>(), and <a href="#path">path</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="cleanDirPath"></a>TQDir::cleanDirPath ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;filePath )<tt> [static]</tt>
</h3>
Removes all multiple directory separators "/" and resolves any
"."s or ".."s found in the path, <em>filePath</em>.
<p> Symbolic links are kept. This function does not return the
canonical path, but rather the simplest version of the input.
For example, "./local" becomes "local", "local/../bin" becomes
"bin" and "/local/usr/../bin" becomes "/local/bin".
<p> <p>See also <a href="#absPath">absPath</a>() and <a href="#canonicalPath">canonicalPath</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="convertSeparators"></a>TQDir::convertSeparators ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;pathName )<tt> [static]</tt>
</h3>
Returns <em>pathName</em> with the '/' separators converted to
separators that are appropriate for the underlying operating
system.
<p> On Windows, <a href="#convertSeparators">convertSeparators</a>("c:/winnt/system32") returns
"c:\winnt\system32".
<p> The returned string may be the same as the argument on some
operating systems, for example on Unix.
<p>Examples: <a href="dirview-example.html#x1664">dirview/dirview.cpp</a> and <a href="fileiconview-example.html#x811">fileiconview/qfileiconview.cpp</a>.
<h3 class=fn>void <a name="convertToAbs"></a>TQDir::convertToAbs ()<tt> [virtual]</tt>
</h3>
Converts the directory path to an absolute path. If it is already
absolute nothing is done.
<p> <p>See also <a href="#isRelative">isRelative</a>().
<h3 class=fn>uint <a name="count"></a>TQDir::count () const
</h3>
Returns the total number of directories and files that were found.
<p> Equivalent to <a href="#entryList">entryList</a>().<a href="#count">count</a>().
<p> <p>See also <a href="#operator[]">operator[]</a>() and <a href="#entryList">entryList</a>().
<h3 class=fn><a href="ntqdir.html">TQDir</a> <a name="current"></a>TQDir::current ()<tt> [static]</tt>
</h3>
Returns the application's current directory.
<p> Use <a href="#path">path</a>() to access a TQDir object's path.
<p> <p>See also <a href="#currentDirPath">currentDirPath</a>() and <a href="#TQDir">TQDir::TQDir</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="currentDirPath"></a>TQDir::currentDirPath ()<tt> [static]</tt>
</h3>
Returns the absolute path of the application's current directory.
<p> <p>See also <a href="#current">current</a>().
<p>Examples: <a href="dirview-example.html#x1665">dirview/dirview.cpp</a>, <a href="helpviewer-example.html#x986">helpviewer/helpwindow.cpp</a>, and <a href="qdir-example.html#x1813">qdir/qdir.cpp</a>.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="dirName"></a>TQDir::dirName () const<tt> [virtual]</tt>
</h3>
Returns the name of the directory; this is <em>not</em> the same as the
path, e.g. a directory with the name "mail", might have the path
"/var/spool/mail". If the directory has no name (e.g. it is the
root directory) <a href="ntqstring.html#TQString-null">TQString::null</a> is returned.
<p> No check is made to ensure that a directory with this name
actually exists.
<p> <p>See also <a href="#path">path</a>(), <a href="#absPath">absPath</a>(), <a href="#absFilePath">absFilePath</a>(), <a href="#exists">exists</a>(), and <a href="ntqstring.html#isNull">TQString::isNull</a>().
<h3 class=fn>const TQFileInfoList * <a name="drives"></a>TQDir::drives ()<tt> [static]</tt>
</h3>
Returns a list of the root directories on this system. On Windows
this returns a number of <a href="ntqfileinfo.html">TQFileInfo</a> objects containing "C:/", "D:/"
etc. On other operating systems, it returns a list containing just
one root directory (e.g. "/").
<p> The returned pointer is owned by TQt. Callers should <em>not</em> delete
or modify it.
<p>Example: <a href="dirview-example.html#x1712">dirview/main.cpp</a>.
<h3 class=fn><a href="ntqstrlist.html">TQStrList</a> <a name="encodedEntryList"></a>TQDir::encodedEntryList ( int&nbsp;filterSpec = DefaultFilter, int&nbsp;sortSpec = DefaultSort ) const<tt> [virtual]</tt>
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> This function is included to easy porting from TQt 1.x to TQt 2.0,
it is the same as <a href="#entryList">entryList</a>(), but encodes the filenames as 8-bit
strings using TQFile::encodedName().
<p> It is more efficient to use entryList().
<h3 class=fn><a href="ntqstrlist.html">TQStrList</a> <a name="encodedEntryList-2"></a>TQDir::encodedEntryList ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;nameFilter, int&nbsp;filterSpec = DefaultFilter, int&nbsp;sortSpec = DefaultSort ) const<tt> [virtual]</tt>
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> This function is included to easy porting from TQt 1.x to TQt 2.0,
it is the same as <a href="#entryList">entryList</a>(), but encodes the filenames as 8-bit
strings using TQFile::encodedName().
<p> It is more efficient to use entryList().
<h3 class=fn>const TQFileInfoList * <a name="entryInfoList"></a>TQDir::entryInfoList ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;nameFilter, int&nbsp;filterSpec = DefaultFilter, int&nbsp;sortSpec = DefaultSort ) const<tt> [virtual]</tt>
</h3>
Returns a list of <a href="ntqfileinfo.html">TQFileInfo</a> objects for all the files and
directories in the directory, ordered in accordance with
<a href="#setSorting">setSorting</a>() and filtered in accordance with <a href="#setFilter">setFilter</a>() and
<a href="#setNameFilter">setNameFilter</a>().
<p> The filter and sorting specifications can be overridden using the
<em>nameFilter</em>, <em>filterSpec</em> and <em>sortSpec</em> arguments.
<p> Returns 0 if the directory is unreadable or does not exist.
<p> The returned pointer is a const pointer to a TQFileInfoList. The
list is owned by the TQDir object and will be reused on the next
call to <a href="#entryInfoList">entryInfoList</a>() for the same TQDir instance. If you want to
keep the entries of the list after a subsequent call to this
function you must copy them.
<p> Note: TQFileInfoList is really a <a href="ntqptrlist.html">TQPtrList</a><TQFileInfo>.
<p> <p>See also <a href="#entryList">entryList</a>(), <a href="#setNameFilter">setNameFilter</a>(), <a href="#setSorting">setSorting</a>(), and <a href="#setFilter">setFilter</a>().
<p>Examples: <a href="dirview-example.html#x1666">dirview/dirview.cpp</a> and <a href="fileiconview-example.html#x812">fileiconview/qfileiconview.cpp</a>.
<h3 class=fn>const TQFileInfoList * <a name="entryInfoList-2"></a>TQDir::entryInfoList ( int&nbsp;filterSpec = DefaultFilter, int&nbsp;sortSpec = DefaultSort ) const<tt> [virtual]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns a list of <a href="ntqfileinfo.html">TQFileInfo</a> objects for all the files and
directories in the directory, ordered in accordance with
<a href="#setSorting">setSorting</a>() and filtered in accordance with <a href="#setFilter">setFilter</a>() and
<a href="#setNameFilter">setNameFilter</a>().
<p> The filter and sorting specifications can be overridden using the
<em>filterSpec</em> and <em>sortSpec</em> arguments.
<p> Returns 0 if the directory is unreadable or does not exist.
<p> The returned pointer is a const pointer to a TQFileInfoList. The
list is owned by the TQDir object and will be reused on the next
call to <a href="#entryInfoList">entryInfoList</a>() for the same TQDir instance. If you want to
keep the entries of the list after a subsequent call to this
function you must copy them.
<p> Note: TQFileInfoList is really a <a href="ntqptrlist.html">TQPtrList</a><TQFileInfo>.
<p> <p>See also <a href="#entryList">entryList</a>(), <a href="#setNameFilter">setNameFilter</a>(), <a href="#setSorting">setSorting</a>(), and <a href="#setFilter">setFilter</a>().
<h3 class=fn><a href="ntqstringlist.html">TQStringList</a> <a name="entryList"></a>TQDir::entryList ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;nameFilter, int&nbsp;filterSpec = DefaultFilter, int&nbsp;sortSpec = DefaultSort ) const<tt> [virtual]</tt>
</h3>
Returns a list of the names of all the files and directories in
the directory, ordered in accordance with <a href="#setSorting">setSorting</a>() and
filtered in accordance with <a href="#setFilter">setFilter</a>() and <a href="#setNameFilter">setNameFilter</a>().
<p> The filter and sorting specifications can be overridden using the
<em>nameFilter</em>, <em>filterSpec</em> and <em>sortSpec</em> arguments.
<p> Returns an empty list if the directory is unreadable or does not
exist.
<p> <p>See also <a href="#entryInfoList">entryInfoList</a>(), <a href="#setNameFilter">setNameFilter</a>(), <a href="#setSorting">setSorting</a>(), and <a href="#setFilter">setFilter</a>().
<p>Example: <a href="statistics-example.html#x2780">table/statistics/statistics.cpp</a>.
<h3 class=fn><a href="ntqstringlist.html">TQStringList</a> <a name="entryList-2"></a>TQDir::entryList ( int&nbsp;filterSpec = DefaultFilter, int&nbsp;sortSpec = DefaultSort ) const<tt> [virtual]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns a list of the names of all the files and directories in
the directory, ordered in accordance with <a href="#setSorting">setSorting</a>() and
filtered in accordance with <a href="#setFilter">setFilter</a>() and <a href="#setNameFilter">setNameFilter</a>().
<p> The filter and sorting specifications can be overridden using the
<em>filterSpec</em> and <em>sortSpec</em> arguments.
<p> Returns an empty list if the directory is unreadable or does not
exist.
<p> <p>See also <a href="#entryInfoList">entryInfoList</a>(), <a href="#setNameFilter">setNameFilter</a>(), <a href="#setSorting">setSorting</a>(), and <a href="#setFilter">setFilter</a>().
<h3 class=fn>bool <a name="exists"></a>TQDir::exists ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;name, bool&nbsp;acceptAbsPath = TRUE )<tt> [virtual]</tt>
</h3>
Checks for the existence of the file <em>name</em>.
<p> If <em>acceptAbsPath</em> is TRUE a path starting with separator "/"
will check the file with the absolute path. If <em>acceptAbsPath</em> is
FALSE any number of separators at the beginning of <em>name</em> will be
removed and the resultant file name will be checked.
<p> Returns TRUE if the file exists; otherwise returns FALSE.
<p> <p>See also <a href="ntqfileinfo.html#exists">TQFileInfo::exists</a>() and <a href="ntqfile.html#exists">TQFile::exists</a>().
<h3 class=fn>bool <a name="exists-2"></a>TQDir::exists () const<tt> [virtual]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns TRUE if the <em>directory</em> exists; otherwise returns FALSE.
(If a file with the same name is found this function will return
FALSE).
<p> <p>See also <a href="ntqfileinfo.html#exists">TQFileInfo::exists</a>() and <a href="ntqfile.html#exists">TQFile::exists</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="filePath"></a>TQDir::filePath ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;fileName, bool&nbsp;acceptAbsPath = TRUE ) const<tt> [virtual]</tt>
</h3>
Returns the path name of a file in the directory. Does <em>not</em>
check if the file actually exists in the directory. If the TQDir is
relative the returned path name will also be relative. Redundant
multiple separators or "." and ".." directories in <em>fileName</em>
will not be removed (see <a href="#cleanDirPath">cleanDirPath</a>()).
<p> If <em>acceptAbsPath</em> is TRUE a <em>fileName</em> starting with a
separator "/" will be returned without change. If <em>acceptAbsPath</em>
is FALSE an absolute path will be prepended to the fileName and
the resultant string returned.
<p> <p>See also <a href="#absFilePath">absFilePath</a>(), <a href="#isRelative">isRelative</a>(), and <a href="#canonicalPath">canonicalPath</a>().
<h3 class=fn><a href="ntqdir.html#FilterSpec-enum">FilterSpec</a> <a name="filter"></a>TQDir::filter () const
</h3>
<p> Returns the value set by <a href="#setFilter">setFilter</a>()
<h3 class=fn><a href="ntqdir.html">TQDir</a> <a name="home"></a>TQDir::home ()<tt> [static]</tt>
</h3>
Returns the home directory.
<p> Under Windows the <tt>HOME</tt> environment variable is used. If this
does not exist the <tt>USERPROFILE</tt> environment variable is used. If
that does not exist the path is formed by concatenating the <tt>HOMEDRIVE</tt> and <tt>HOMEPATH</tt> environment variables. If they don't
exist the <a href="#rootDirPath">rootDirPath</a>() is used (this uses the <tt>SystemDrive</tt>
environment variable). If none of these exist "C:&#92;" is used.
<p> Under non-Windows operating systems the <tt>HOME</tt> environment
variable is used if it exists, otherwise rootDirPath() is used.
<p> <p>See also <a href="#homeDirPath">homeDirPath</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="homeDirPath"></a>TQDir::homeDirPath ()<tt> [static]</tt>
</h3>
<p> Returns the absolute path of the user's home directory.
<p> <p>See also <a href="#home">home</a>().
<h3 class=fn>bool <a name="isReadable"></a>TQDir::isReadable () const<tt> [virtual]</tt>
</h3>
Returns TRUE if the directory is readable <em>and</em> we can open files
by name; otherwise returns FALSE.
<p> <b>Warning:</b> A FALSE value from this function is not a guarantee that
files in the directory are not accessible.
<p> <p>See also <a href="ntqfileinfo.html#isReadable">TQFileInfo::isReadable</a>().
<p>Examples: <a href="dirview-example.html#x1667">dirview/dirview.cpp</a> and <a href="fileiconview-example.html#x813">fileiconview/qfileiconview.cpp</a>.
<h3 class=fn>bool <a name="isRelative"></a>TQDir::isRelative () const<tt> [virtual]</tt>
</h3>
Returns TRUE if the directory path is relative to the current
directory and returns FALSE if the path is absolute (e.g. under
UNIX a path is relative if it does not start with a "/").
<p> <p>See also <a href="#convertToAbs">convertToAbs</a>().
<h3 class=fn>bool <a name="isRelativePath"></a>TQDir::isRelativePath ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;path )<tt> [static]</tt>
</h3>
Returns TRUE if <em>path</em> is relative; returns FALSE if it is
absolute.
<p> <p>See also <a href="#isRelative">isRelative</a>().
<h3 class=fn>bool <a name="isRoot"></a>TQDir::isRoot () const<tt> [virtual]</tt>
</h3>
Returns TRUE if the directory is the root directory; otherwise
returns FALSE.
<p> Note: If the directory is a symbolic link to the root directory
this function returns FALSE. If you want to test for this use
<a href="#canonicalPath">canonicalPath</a>(), e.g.
<pre>
TQDir d( "/tmp/root_link" );
d = d.<a href="#canonicalPath">canonicalPath</a>();
if ( d.<a href="#isRoot">isRoot</a>() )
<a href="ntqapplication.html#qWarning">tqWarning</a>( "It is a root link" );
</pre>
<p> <p>See also <a href="#root">root</a>() and <a href="#rootDirPath">rootDirPath</a>().
<h3 class=fn>bool <a name="match"></a>TQDir::match ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;filter, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;fileName )<tt> [static]</tt>
</h3>
Returns TRUE if the <em>fileName</em> matches the wildcard (glob)
pattern <em>filter</em>; otherwise returns FALSE. The <em>filter</em> may
contain multiple patterns separated by spaces or semicolons.
<p> (See <a href="ntqregexp.html#wildcard-matching">TQRegExp wildcard
matching.</a>)
<p>See also <a href="ntqregexp.html#match">TQRegExp::match</a>().
<h3 class=fn>bool <a name="match-2"></a>TQDir::match ( const&nbsp;<a href="ntqstringlist.html">TQStringList</a>&nbsp;&amp;&nbsp;filters, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;fileName )<tt> [static]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns TRUE if the <em>fileName</em> matches any of the wildcard (glob)
patterns in the list of <em>filters</em>; otherwise returns FALSE.
<p> (See <a href="ntqregexp.html#wildcard-matching">TQRegExp wildcard
matching.</a>)
<p>See also <a href="ntqregexp.html#match">TQRegExp::match</a>().
<h3 class=fn>bool <a name="matchAllDirs"></a>TQDir::matchAllDirs () const
</h3>
<p> Returns the value set by <a href="#setMatchAllDirs">setMatchAllDirs</a>()
<p> <p>See also <a href="#setMatchAllDirs">setMatchAllDirs</a>().
<h3 class=fn>bool <a name="mkdir"></a>TQDir::mkdir ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;dirName, bool&nbsp;acceptAbsPath = TRUE ) const<tt> [virtual]</tt>
</h3>
Creates a directory.
<p> If <em>acceptAbsPath</em> is TRUE a path starting with a separator ('/')
will create the absolute directory; if <em>acceptAbsPath</em> is FALSE
any number of separators at the beginning of <em>dirName</em> will be
removed.
<p> Returns TRUE if successful; otherwise returns FALSE.
<p> <p>See also <a href="#rmdir">rmdir</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="nameFilter"></a>TQDir::nameFilter () const
</h3>
<p> Returns the string set by <a href="#setNameFilter">setNameFilter</a>()
<h3 class=fn>bool <a name="operator!-eq"></a>TQDir::operator!= ( const&nbsp;<a href="ntqdir.html">TQDir</a>&nbsp;&amp;&nbsp;d ) const<tt> [virtual]</tt>
</h3>
<p> Returns TRUE if directory <em>d</em> and this directory have different
paths or different sort or filter settings; otherwise returns
FALSE.
<p> Example:
<pre>
// The current directory is "/usr/local"
TQDir d1( "/usr/local/bin" );
TQDir d2( "bin" );
if ( d1 != d2 )
<a href="ntqapplication.html#qDebug">tqDebug</a>( "They differ" );
</pre>
<h3 class=fn><a href="ntqdir.html">TQDir</a>&nbsp;&amp; <a name="operator-eq"></a>TQDir::operator= ( const&nbsp;<a href="ntqdir.html">TQDir</a>&nbsp;&amp;&nbsp;d )
</h3>
Makes a copy of TQDir <em>d</em> and assigns it to this TQDir.
<h3 class=fn><a href="ntqdir.html">TQDir</a>&nbsp;&amp; <a name="operator-eq-2"></a>TQDir::operator= ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;path )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Sets the directory path to be the given <em>path</em>.
<h3 class=fn>bool <a name="operator-eq-eq"></a>TQDir::operator== ( const&nbsp;<a href="ntqdir.html">TQDir</a>&nbsp;&amp;&nbsp;d ) const<tt> [virtual]</tt>
</h3>
Returns TRUE if directory <em>d</em> and this directory have the same
path and their sort and filter settings are the same; otherwise
returns FALSE.
<p> Example:
<pre>
// The current directory is "/usr/local"
TQDir d1( "/usr/local/bin" );
TQDir d2( "bin" );
d2.<a href="#convertToAbs">convertToAbs</a>();
if ( d1 == d2 )
<a href="ntqapplication.html#qDebug">tqDebug</a>( "They're the same" );
</pre>
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="operator[]"></a>TQDir::operator[] ( int&nbsp;index ) const
</h3>
Returns the file name at position <em>index</em> in the list of file
names. Equivalent to <a href="#entryList">entryList</a>().at(index).
<p> Returns a <a href="ntqstring.html#TQString-null">TQString::null</a> if the <em>index</em> is out of range or if the
entryList() function failed.
<p> <p>See also <a href="#count">count</a>() and <a href="#entryList">entryList</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="path"></a>TQDir::path () const<tt> [virtual]</tt>
</h3>
<p> Returns the path, this may contain symbolic links, but never
contains redundant ".", ".." or multiple separators.
<p> The returned path can be either absolute or relative (see
<a href="#setPath">setPath</a>()).
<p> <p>See also <a href="#setPath">setPath</a>(), <a href="#absPath">absPath</a>(), <a href="#exists">exists</a>(), <a href="#cleanDirPath">cleanDirPath</a>(), <a href="#dirName">dirName</a>(), <a href="#absFilePath">absFilePath</a>(), and <a href="#convertSeparators">convertSeparators</a>().
<h3 class=fn>void <a name="refresh"></a>TQDir::refresh () const
</h3>
Refreshes the directory information.
<h3 class=fn>bool <a name="remove"></a>TQDir::remove ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;fileName, bool&nbsp;acceptAbsPath = TRUE )<tt> [virtual]</tt>
</h3>
Removes the file, <em>fileName</em>.
<p> If <em>acceptAbsPath</em> is TRUE a path starting with separator "/"
will remove the file with the absolute path. If <em>acceptAbsPath</em>
is FALSE any number of separators at the beginning of <em>fileName</em>
will be removed and the resultant file name will be removed.
<p> Returns TRUE if the file is removed successfully; otherwise
returns FALSE.
<h3 class=fn>bool <a name="rename"></a>TQDir::rename ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;oldName, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;newName, bool&nbsp;acceptAbsPaths = TRUE )<tt> [virtual]</tt>
</h3>
Renames a file or directory.
<p> If <em>acceptAbsPaths</em> is TRUE a path starting with a separator
('/') will rename the file with the absolute path; if <em>acceptAbsPaths</em> is FALSE any number of separators at the beginning
of the names will be removed.
<p> Returns TRUE if successful; otherwise returns FALSE.
<p> On most file systems, <a href="#rename">rename</a>() fails only if <em>oldName</em> does not
exist or if <em>newName</em> and <em>oldName</em> are not on the same
partition. On Windows, rename() will fail if <em>newName</em> already
exists. However, there are also other reasons why rename() can
fail. For example, on at least one file system rename() fails if
<em>newName</em> points to an open file.
<p>Example: <a href="fileiconview-example.html#x814">fileiconview/qfileiconview.cpp</a>.
<h3 class=fn>bool <a name="rmdir"></a>TQDir::rmdir ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;dirName, bool&nbsp;acceptAbsPath = TRUE ) const<tt> [virtual]</tt>
</h3>
Removes a directory.
<p> If <em>acceptAbsPath</em> is TRUE a path starting with a separator ('/')
will remove the absolute directory; if <em>acceptAbsPath</em> is FALSE
any number of separators at the beginning of <em>dirName</em> will be
removed.
<p> The directory must be empty for <a href="#rmdir">rmdir</a>() to succeed.
<p> Returns TRUE if successful; otherwise returns FALSE.
<p> <p>See also <a href="#mkdir">mkdir</a>().
<h3 class=fn><a href="ntqdir.html">TQDir</a> <a name="root"></a>TQDir::root ()<tt> [static]</tt>
</h3>
Returns the root directory.
<p> <p>See also <a href="#rootDirPath">rootDirPath</a>() and <a href="#drives">drives</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="rootDirPath"></a>TQDir::rootDirPath ()<tt> [static]</tt>
</h3>
Returns the absolute path for the root directory.
<p> For UNIX operating systems this returns "/". For Windows file
systems this normally returns "c:/".
<p> <p>See also <a href="#root">root</a>() and <a href="#drives">drives</a>().
<h3 class=fn>char <a name="separator"></a>TQDir::separator ()<tt> [static]</tt>
</h3>
Returns the native directory separator; "/" under UNIX (including
Mac OS X) and "&#92;" under Windows.
<p> You do not need to use this function to build file paths. If you
always use "/", TQt will translate your paths to conform to the
underlying operating system.
<h3 class=fn>bool <a name="setCurrent"></a>TQDir::setCurrent ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;path )<tt> [static]</tt>
</h3>
Sets the application's current working directory to <em>path</em>.
Returns TRUE if the directory was successfully changed; otherwise
returns FALSE.
<h3 class=fn>void <a name="setFilter"></a>TQDir::setFilter ( int&nbsp;filterSpec )<tt> [virtual]</tt>
</h3>
Sets the filter used by <a href="#entryList">entryList</a>() and <a href="#entryInfoList">entryInfoList</a>() to <em>filterSpec</em>. The filter is used to specify the kind of files that
should be returned by entryList() and entryInfoList(). See
<a href="#FilterSpec-enum">TQDir::FilterSpec</a>.
<p> <p>See also <a href="#filter">filter</a>() and <a href="#setNameFilter">setNameFilter</a>().
<h3 class=fn>void <a name="setMatchAllDirs"></a>TQDir::setMatchAllDirs ( bool&nbsp;enable )<tt> [virtual]</tt>
</h3>
If <em>enable</em> is TRUE then all directories are included (e.g. in
<a href="#entryList">entryList</a>()), and the <a href="#nameFilter">nameFilter</a>() is only applied to the files.
If <em>enable</em> is FALSE then the nameFilter() is applied to both
directories and files.
<p> <p>See also <a href="#matchAllDirs">matchAllDirs</a>().
<h3 class=fn>void <a name="setNameFilter"></a>TQDir::setNameFilter ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;nameFilter )<tt> [virtual]</tt>
</h3>
Sets the name filter used by <a href="#entryList">entryList</a>() and <a href="#entryInfoList">entryInfoList</a>() to <em>nameFilter</em>.
<p> The <em>nameFilter</em> is a wildcard (globbing) filter that understands
"*" and "?" wildcards. (See <a href="ntqregexp.html#wildcard-matching">TQRegExp wildcard matching</a>.) You may specify several filter
entries all separated by a single space " " or by a semi-colon
";".
<p> For example, if you want entryList() and entryInfoList() to list
all files ending with either ".cpp" or ".h", you would use either
dir.<a href="#setNameFilter">setNameFilter</a>("*.cpp *.h") or dir.setNameFilter("*.cpp;*.h").
<p> <p>See also <a href="#nameFilter">nameFilter</a>() and <a href="#setFilter">setFilter</a>().
<h3 class=fn>void <a name="setPath"></a>TQDir::setPath ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;path )<tt> [virtual]</tt>
</h3>
Sets the path of the directory to <em>path</em>. The path is cleaned of
redundant ".", ".." and of multiple separators. No check is made
to ensure that a directory with this path exists.
<p> The path can be either absolute or relative. Absolute paths begin
with the directory separator "/" (optionally preceded by a drive
specification under Windows). Relative file names begin with a
directory name or a file name and specify a path relative to the
current directory. An example of an absolute path is the string
"/tmp/quartz", a relative path might look like "src/fatlib".
<p> <p>See also <a href="#path">path</a>(), <a href="#absPath">absPath</a>(), <a href="#exists">exists</a>(), <a href="#cleanDirPath">cleanDirPath</a>(), <a href="#dirName">dirName</a>(), <a href="#absFilePath">absFilePath</a>(), <a href="#isRelative">isRelative</a>(), and <a href="#convertToAbs">convertToAbs</a>().
<h3 class=fn>void <a name="setSorting"></a>TQDir::setSorting ( int&nbsp;sortSpec )<tt> [virtual]</tt>
</h3>
Sets the sort order used by <a href="#entryList">entryList</a>() and <a href="#entryInfoList">entryInfoList</a>().
<p> The <em>sortSpec</em> is specified by OR-ing values from the enum
<a href="#SortSpec-enum">TQDir::SortSpec</a>.
<p> <p>See also <a href="#sorting">sorting</a>() and <a href="#SortSpec-enum">SortSpec</a>.
<h3 class=fn><a href="ntqdir.html#SortSpec-enum">SortSpec</a> <a name="sorting"></a>TQDir::sorting () const
</h3>
<p> Returns the value set by <a href="#setSorting">setSorting</a>()
<p> <p>See also <a href="#setSorting">setSorting</a>() and <a href="#SortSpec-enum">SortSpec</a>.
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright &copy; 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>