aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/a02524.html
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2018-08-11 20:21:34 +0200
committerneodarz <neodarz@neodarz.net>2018-08-11 20:21:34 +0200
commit0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch)
tree2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/a02524.html
downloadnevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz
nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip
Initial commit
Diffstat (limited to '')
-rw-r--r--docs/doxygen/nel/a02524.html1193
1 files changed, 1193 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a02524.html b/docs/doxygen/nel/a02524.html
new file mode 100644
index 00000000..bbf5b5c6
--- /dev/null
+++ b/docs/doxygen/nel/a02524.html
@@ -0,0 +1,1193 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+<title>NeL: NLMISC::CFile struct Reference</title>
+<link href="doxygen.css" rel="stylesheet" type="text/css">
+</head><body>
+<!-- Generated by Doxygen 1.3.6 -->
+<div class="qindex"> <form class="search" action="search.php" method="get">
+<a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a> | <span class="search"><u>S</u>earch&nbsp;for&nbsp;<input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
+<h1>NLMISC::CFile Struct Reference</h1><code>#include &lt;<a class="el" href="a06168.html">path.h</a>&gt;</code>
+<p>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Utility class for file manipulation <dl compact><dt><b>Author:</b></dt><dd>Vianney Lecroart <p>
+Nevrax France </dd></dl>
+<dl compact><dt><b>Date:</b></dt><dd>2001 </dd></dl>
+
+<p>
+
+<p>
+Definition at line <a class="el" href="a06168.html#l00317">317</a> of file <a class="el" href="a06168.html">path.h</a>.<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Static Public Member Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02524.html#NLMISC_1_1CFilee0">addFileChangeCallback</a> (const std::string &amp;<a class="el" href="a04560.html#a1">filename</a>, void(*)(const std::string &amp;<a class="el" href="a04560.html#a1">filename</a>))</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02524.html#NLMISC_1_1CFilee1">checkFileChange</a> (<a class="el" href="a05378.html#a242">TTime</a> frequency=1000)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02524.html#NLMISC_1_1CFilee2">copyFile</a> (const char *dest, const char *<a class="el" href="a04223.html#a652">src</a>, bool failIfExists=false)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02524.html#NLMISC_1_1CFilee3">createDirectory</a> (const std::string &amp;dirname)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02524.html#NLMISC_1_1CFilee4">deleteFile</a> (const std::string &amp;<a class="el" href="a04560.html#a1">filename</a>)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02524.html#NLMISC_1_1CFilee5">fileExists</a> (const std::string &amp;<a class="el" href="a04560.html#a1">filename</a>)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>std::string&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02524.html#NLMISC_1_1CFilee6">findNewFile</a> (const std::string &amp;<a class="el" href="a04560.html#a1">filename</a>)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>std::string&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02524.html#NLMISC_1_1CFilee7">getExtension</a> (const std::string &amp;<a class="el" href="a04560.html#a1">filename</a>)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02524.html#NLMISC_1_1CFilee8">getFileCreationDate</a> (const std::string &amp;<a class="el" href="a04560.html#a1">filename</a>)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02524.html#NLMISC_1_1CFilee9">getFileModificationDate</a> (const std::string &amp;<a class="el" href="a04560.html#a1">filename</a>)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>std::string&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02524.html#NLMISC_1_1CFilee10">getFilename</a> (const std::string &amp;<a class="el" href="a04560.html#a1">filename</a>)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>std::string&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02524.html#NLMISC_1_1CFilee11">getFilenameWithoutExtension</a> (const std::string &amp;<a class="el" href="a04560.html#a1">filename</a>)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02524.html#NLMISC_1_1CFilee12">getFileSize</a> (FILE *f)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02524.html#NLMISC_1_1CFilee13">getFileSize</a> (const std::string &amp;<a class="el" href="a04560.html#a1">filename</a>)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02524.html#NLMISC_1_1CFilee14">getLastSeparator</a> (const std::string &amp;<a class="el" href="a04560.html#a1">filename</a>)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>std::string&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02524.html#NLMISC_1_1CFilee15">getPath</a> (const std::string &amp;<a class="el" href="a04560.html#a1">filename</a>)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02524.html#NLMISC_1_1CFilee16">getTemporaryOutputFilename</a> (const std::string &amp;originalFilename, std::string &amp;tempFilename)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02524.html#NLMISC_1_1CFilee17">isDirectory</a> (const std::string &amp;<a class="el" href="a04560.html#a1">filename</a>)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02524.html#NLMISC_1_1CFilee18">isExists</a> (const std::string &amp;<a class="el" href="a04560.html#a1">filename</a>)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02524.html#NLMISC_1_1CFilee19">moveFile</a> (const char *dest, const char *<a class="el" href="a04223.html#a652">src</a>)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02524.html#NLMISC_1_1CFilee20">removeFileChangeCallback</a> (const std::string &amp;<a class="el" href="a04560.html#a1">filename</a>)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02524.html#NLMISC_1_1CFilee21">setRWAccess</a> (const std::string &amp;<a class="el" href="a04560.html#a1">filename</a>)</td></tr>
+
+</table>
+<hr><h2>Member Function Documentation</h2>
+<a class="anchor" name="NLMISC_1_1CFilee0" doxytag="NLMISC::CFile::addFileChangeCallback" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void NLMISC::CFile::addFileChangeCallback </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>filename</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>void(*&nbsp;</td>
+ <td class="mdname" nowrap>)(const std::string &amp;<a class="el" href="a04560.html#a1">filename</a>)</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"><code> [static]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Add a callback that will be call when the content file, named filename, changed. The system use the file modification date. To work, you need to call evenly the function <a class="el" href="a02524.html#NLMISC_1_1CFilee1">checkFileChange()</a>, this function only checks every 1s by default (you can change the default time)<p>
+ie: void cb (const std::string &amp;filename) { nlinfo ("the file %s changed", filename.c_str()); } <a class="el" href="a02524.html#NLMISC_1_1CFilee0">CFile::addFileChangeCallback</a> ("myfile.txt", cb);
+<p>
+Definition at line <a class="el" href="a06167.html#l01567">1567</a> of file <a class="el" href="a06167.html">path.cpp</a>.
+<p>
+Referenced by <a class="el" href="a05668.html#l00405">NLMISC::CEntityIdTranslator::load()</a>.
+<p>
+<div class="fragment"><pre>01568 {
+01569 string fn = CPath::lookup(filename, <span class="keyword">false</span>, <span class="keyword">false</span>);
+01570 <span class="keywordflow">if</span> (fn.empty())
+01571 {
+01572 fn = <a class="code" href="a05377.html#a2">filename</a>;
+01573 }
+01574 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"PATH: CFile::addFileChangeCallback: I'll check the modification date for this file '%s'"</span>, fn.c_str());
+01575 <a class="code" href="a05378.html#a32">FileToCheck</a>.push_back(CFileEntry(fn, cb));
+01576 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CFilee1" doxytag="NLMISC::CFile::checkFileChange" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void NLMISC::CFile::checkFileChange </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="a05378.html#a242">TTime</a>&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>frequency</em> = 1000 </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap><code> [static]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+You have to call this function evenly (each frame for example) to enable the file change callback system. If the file not exists and is created in the run time, the callback will be called. If the file exists and is removed in the run time, the callback will be called.<p>
+<dl compact><dt><b>Parameters:</b></dt><dd>
+ <table border="0" cellspacing="2" cellpadding="0">
+ <tr><td valign=top><em>frequency</em>&nbsp;</td><td>the time in millisecond that we wait before check another time (1s by default).</td></tr>
+ </table>
+</dl>
+
+<p>
+Definition at line <a class="el" href="a06167.html#l01578">1578</a> of file <a class="el" href="a06167.html">path.cpp</a>.
+<p>
+References <a class="el" href="a05646.html#l00649">buffer</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, and <a class="el" href="a05646.html#l00977">s</a>.
+<p>
+<div class="fragment"><pre>01579 {
+01580 <span class="keyword">static</span> <a class="code" href="a05378.html#a242">TTime</a> lastChecked = CTime::getLocalTime();
+01581
+01582 <span class="keywordflow">if</span> (CTime::getLocalTime() &gt; lastChecked + frequency)
+01583 {
+01584 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i = 0; i &lt; <a class="code" href="a05378.html#a32">FileToCheck</a>.size(); i++)
+01585 {
+01586 <span class="keywordflow">if</span>(CFile::getFileModificationDate(FileToCheck[i].FileName) != <a class="code" href="a05378.html#a32">FileToCheck</a>[i].LastModified)
+01587 {
+01588 <span class="comment">// need to reload it</span>
+01589 <span class="keywordflow">if</span>(<a class="code" href="a05378.html#a32">FileToCheck</a>[i].Callback != NULL)
+01590 <a class="code" href="a05378.html#a32">FileToCheck</a>[i].Callback(FileToCheck[i].FileName);
+01591
+01592 <a class="code" href="a05378.html#a32">FileToCheck</a>[i].LastModified = CFile::getFileModificationDate(FileToCheck[i].FileName);
+01593 }
+01594 }
+01595
+01596 lastChecked = CTime::getLocalTime();
+01597 }
+01598 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CFilee2" doxytag="NLMISC::CFile::copyFile" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> bool NLMISC::CFile::copyFile </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dest</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>src</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>failIfExists</em> = false</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"><code> [static]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Copy a file NB this keeps file attributes <dl compact><dt><b>Parameters:</b></dt><dd>
+ <table border="0" cellspacing="2" cellpadding="0">
+ <tr><td valign=top><em>failIfExists</em>&nbsp;</td><td>If the destination file exists, nothing is done, and it returns false. </td></tr>
+ </table>
+</dl>
+<dl compact><dt><b>Returns:</b></dt><dd>true if the copy succeeded</dd></dl>
+
+<p>
+Definition at line <a class="el" href="a06167.html#l01653">1653</a> of file <a class="el" href="a06167.html">path.cpp</a>.
+<p>
+References <a class="el" href="a05646.html#l00645">size</a>, and <a class="el" href="a05646.html#l01124">src</a>.
+<p>
+<div class="fragment"><pre>01654 {
+01655 <span class="keywordflow">return</span> <a class="code" href="a05378.html#a344">CopyMoveFile</a>(dest, src, <span class="keyword">true</span>, failIfExists);
+01656 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CFilee3" doxytag="NLMISC::CFile::createDirectory" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> bool NLMISC::CFile::createDirectory </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dirname</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap><code> [static]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create a directory <dl compact><dt><b>Returns:</b></dt><dd>true if succes</dd></dl>
+
+<p>
+Definition at line <a class="el" href="a06167.html#l01664">1664</a> of file <a class="el" href="a06167.html">path.cpp</a>.
+<p>
+References <a class="el" href="a05981.html#l00105">uint</a>.
+<p>
+<div class="fragment"><pre>01665 {
+01666 <span class="preprocessor">#ifdef NL_OS_WINDOWS</span>
+01667 <span class="preprocessor"></span> <span class="keywordflow">return</span> _mkdir(<a class="code" href="a05377.html#a2">filename</a>.c_str())==0;
+01668 <span class="preprocessor">#else</span>
+01669 <span class="preprocessor"></span> <span class="comment">// Set full permissions....</span>
+01670 <span class="keywordflow">return</span> mkdir(<a class="code" href="a05377.html#a2">filename</a>.c_str(), 0xFFFF)==0;
+01671 <span class="preprocessor">#endif</span>
+01672 <span class="preprocessor"></span>}
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CFilee4" doxytag="NLMISC::CFile::deleteFile" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> bool NLMISC::CFile::deleteFile </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>filename</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap><code> [static]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Delete a file if possible (change the write access if possible) <dl compact><dt><b>Returns:</b></dt><dd>true if the delete occurs.</dd></dl>
+
+<p>
+Definition at line <a class="el" href="a06167.html#l01757">1757</a> of file <a class="el" href="a06167.html">path.cpp</a>.
+<p>
+<div class="fragment"><pre>01758 {
+01759 <a class="code" href="a02524.html#NLMISC_1_1CFilee21">setRWAccess</a>(filename);
+01760 <span class="keywordtype">int</span> <a class="code" href="a04223.html#a643">res</a> = unlink (<a class="code" href="a05377.html#a2">filename</a>.c_str());
+01761 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a643">res</a> == -1)
+01762 {
+01763 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"PATH: Can't delete file '%s': %d %s"</span>, <a class="code" href="a05377.html#a2">filename</a>.c_str(), errno, strerror(errno));
+01764 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+01765 }
+01766 <span class="keywordflow">return</span> <span class="keyword">true</span>;
+01767 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CFilee5" doxytag="NLMISC::CFile::fileExists" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> bool NLMISC::CFile::fileExists </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>filename</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap><code> [static]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return true if the file exists. Warning: this test will also tell that the file does not exist if you don't have the rights to read it (Unix).
+<p>
+Definition at line <a class="el" href="a06167.html#l01402">1402</a> of file <a class="el" href="a06167.html">path.cpp</a>.
+<p>
+Referenced by <a class="el" href="a05597.html#l00297">NLMISC::CConfigFile::reparse()</a>.
+<p>
+<div class="fragment"><pre>01403 {
+01404 <a class="code" href="a04365.html#a4">H_AUTO</a>(FileExists);
+01405 <span class="keywordflow">return</span> ! ! fstream( <a class="code" href="a05377.html#a2">filename</a>.c_str(), ios::in );
+01406 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CFilee6" doxytag="NLMISC::CFile::findNewFile" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> string NLMISC::CFile::findNewFile </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>filename</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap><code> [static]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return a new filename that doesn't exists. It's used for screenshot filename for example. example: findNewFile("foobar.tga"); will try foobar001.tga, if the file exists, try foobar002.tga and so on until it finds an unexistant file.
+<p>
+Definition at line <a class="el" href="a06167.html#l01409">1409</a> of file <a class="el" href="a06167.html">path.cpp</a>.
+<p>
+References <a class="el" href="a05981.html#l00100">uint32</a>.
+<p>
+<div class="fragment"><pre>01410 {
+01411 <a class="code" href="a04558.html#a11">uint32</a> pos = <a class="code" href="a05377.html#a2">filename</a>.find_last_of (<span class="charliteral">'.'</span>);
+01412 <span class="keywordflow">if</span> (pos == string::npos)
+01413 <span class="keywordflow">return</span> <a class="code" href="a05377.html#a2">filename</a>;
+01414
+01415 string start = <a class="code" href="a05377.html#a2">filename</a>.substr (0, pos);
+01416 string end = <a class="code" href="a05377.html#a2">filename</a>.substr (pos);
+01417
+01418 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a653">num</a> = 0;
+01419 <span class="keywordtype">char</span> numchar[4];
+01420 string npath;
+01421 <span class="keywordflow">do</span>
+01422 {
+01423 npath = start;
+01424 <a class="code" href="a05378.html#a259">smprintf</a>(numchar,4,<span class="stringliteral">"%03d"</span>,num++);
+01425 npath += numchar;
+01426 npath += end;
+01427 <span class="keywordflow">if</span> (!CFile::fileExists(npath)) <span class="keywordflow">break</span>;
+01428 }
+01429 <span class="keywordflow">while</span> (<a class="code" href="a04223.html#a653">num</a>&lt;999);
+01430 <span class="keywordflow">return</span> npath;
+01431 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CFilee7" doxytag="NLMISC::CFile::getExtension" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> string NLMISC::CFile::getExtension </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>filename</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap><code> [static]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+
+<p>
+Definition at line <a class="el" href="a06167.html#l01352">1352</a> of file <a class="el" href="a06167.html">path.cpp</a>.
+<p>
+Referenced by <a class="el" href="a05449.html#l00155">NL3D::CAnimationSet::loadFromFiles()</a>.
+<p>
+<div class="fragment"><pre>01353 {
+01354 <a class="code" href="a04558.html#a11">uint32</a> pos = <a class="code" href="a05377.html#a2">filename</a>.find_last_of (<span class="charliteral">'.'</span>);
+01355 <span class="keywordflow">if</span> (pos == string::npos)
+01356 <span class="keywordflow">return</span> <span class="stringliteral">""</span>;
+01357 <span class="keywordflow">else</span>
+01358 <span class="keywordflow">return</span> <a class="code" href="a05377.html#a2">filename</a>.substr (pos + 1);
+01359 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CFilee8" doxytag="NLMISC::CFile::getFileCreationDate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> NLMISC::CFile::getFileCreationDate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>filename</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap><code> [static]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return creation Time of the file. 0 if not found.<p>
+You have to provide the full path of the file (the function doesn't lookup)
+<p>
+Definition at line <a class="el" href="a06167.html#l01511">1511</a> of file <a class="el" href="a06167.html">path.cpp</a>.
+<p>
+References <a class="el" href="a06167.html#l01547">NLMISC::FileToCheck</a>, <a class="el" href="a05622.html#l00111">nlinfo</a>, and <a class="el" href="a05981.html#l00105">uint</a>.
+<p>
+<div class="fragment"><pre>01512 {
+01513 <a class="code" href="a04558.html#a15">uint</a> pos;
+01514 string fn;
+01515 <span class="keywordflow">if</span> ((pos=<a class="code" href="a05377.html#a2">filename</a>.find(<span class="charliteral">'@'</span>)) != string::npos)
+01516 {
+01517 fn = CPath::lookup(<a class="code" href="a05377.html#a2">filename</a>.substr (0, pos));
+01518 }
+01519 <span class="keywordflow">else</span>
+01520 {
+01521 fn = <a class="code" href="a05377.html#a2">filename</a>;
+01522 }
+01523
+01524 <span class="preprocessor">#if defined (NL_OS_WINDOWS)</span>
+01525 <span class="preprocessor"></span> <span class="keyword">struct </span>_stat buf;
+01526 <span class="keywordtype">int</span> result = _stat (fn.c_str (), &amp;buf);
+01527 <span class="preprocessor">#elif defined (NL_OS_UNIX)</span>
+01528 <span class="preprocessor"></span> <span class="keyword">struct </span>stat buf;
+01529 <span class="keywordtype">int</span> result = stat (fn.c_str (), &amp;buf);
+01530 <span class="preprocessor">#endif</span>
+01531 <span class="preprocessor"></span>
+01532 <span class="keywordflow">if</span> (result != 0) <span class="keywordflow">return</span> 0;
+01533 <span class="keywordflow">else</span> <span class="keywordflow">return</span> buf.st_ctime;
+01534 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CFilee9" doxytag="NLMISC::CFile::getFileModificationDate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> NLMISC::CFile::getFileModificationDate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>filename</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap><code> [static]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return Time of last modification of file. 0 if not found.<p>
+You have to provide the full path of the file (the function doesn't lookup)
+<p>
+Definition at line <a class="el" href="a06167.html#l01485">1485</a> of file <a class="el" href="a06167.html">path.cpp</a>.
+<p>
+Referenced by <a class="el" href="a05926.html#l00145">loadForm()</a>.
+<p>
+<div class="fragment"><pre>01486 {
+01487 <a class="code" href="a04558.html#a15">uint</a> pos;
+01488 string fn;
+01489 <span class="keywordflow">if</span> ((pos=<a class="code" href="a05377.html#a2">filename</a>.find(<span class="charliteral">'@'</span>)) != string::npos)
+01490 {
+01491 fn = CPath::lookup(<a class="code" href="a05377.html#a2">filename</a>.substr (0, pos));
+01492 }
+01493 <span class="keywordflow">else</span>
+01494 {
+01495 fn = <a class="code" href="a05377.html#a2">filename</a>;
+01496 }
+01497
+01498 <span class="preprocessor">#if defined (NL_OS_WINDOWS)</span>
+01499 <span class="preprocessor"></span> <span class="keyword">struct </span>_stat buf;
+01500 <span class="keywordtype">int</span> result = _stat (fn.c_str (), &amp;buf);
+01501 <span class="preprocessor">#elif defined (NL_OS_UNIX)</span>
+01502 <span class="preprocessor"></span> <span class="keyword">struct </span>stat buf;
+01503 <span class="keywordtype">int</span> result = stat (fn.c_str (), &amp;buf);
+01504 <span class="preprocessor">#endif</span>
+01505 <span class="preprocessor"></span>
+01506 <span class="keywordflow">if</span> (result != 0) <span class="keywordflow">return</span> 0;
+01507 <span class="keywordflow">else</span> <span class="keywordflow">return</span> buf.st_mtime;
+01508 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CFilee10" doxytag="NLMISC::CFile::getFilename" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> string NLMISC::CFile::getFilename </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>filename</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap><code> [static]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Retrieve the associated file name. An empty string is returned if the path is invalid
+<p>
+Definition at line <a class="el" href="a06167.html#l01333">1333</a> of file <a class="el" href="a06167.html">path.cpp</a>.
+<p>
+References <a class="el" href="a05622.html#l00135">nlwarning</a>, and <a class="el" href="a05646.html#l01119">res</a>.
+<p>
+Referenced by <a class="el" href="a05926.html#l00145">loadForm()</a>.
+<p>
+<div class="fragment"><pre>01334 {
+01335 <a class="code" href="a04558.html#a11">uint32</a> pos = CFile::getLastSeparator(filename);
+01336 <span class="keywordflow">if</span> (pos != string::npos)
+01337 <span class="keywordflow">return</span> <a class="code" href="a05377.html#a2">filename</a>.substr (pos + 1);
+01338 <span class="keywordflow">else</span>
+01339 <span class="keywordflow">return</span> <a class="code" href="a05377.html#a2">filename</a>;
+01340 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CFilee11" doxytag="NLMISC::CFile::getFilenameWithoutExtension" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> string NLMISC::CFile::getFilenameWithoutExtension </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>filename</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap><code> [static]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+
+<p>
+Definition at line <a class="el" href="a06167.html#l01342">1342</a> of file <a class="el" href="a06167.html">path.cpp</a>.
+<p>
+References <a class="el" href="a05646.html#l01119">res</a>.
+<p>
+<div class="fragment"><pre>01343 {
+01344 string filename2 = <a class="code" href="a02524.html#NLMISC_1_1CFilee10">getFilename</a> (filename);
+01345 <a class="code" href="a04558.html#a11">uint32</a> pos = filename2.find_last_of (<span class="charliteral">'.'</span>);
+01346 <span class="keywordflow">if</span> (pos == string::npos)
+01347 <span class="keywordflow">return</span> filename2;
+01348 <span class="keywordflow">else</span>
+01349 <span class="keywordflow">return</span> filename2.substr (0, pos);
+01350 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CFilee12" doxytag="NLMISC::CFile::getFileSize" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> NLMISC::CFile::getFileSize </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">FILE *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>f</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap><code> [static]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return the size of the file (in bytes).
+<p>
+Definition at line <a class="el" href="a06167.html#l01472">1472</a> of file <a class="el" href="a06167.html">path.cpp</a>.
+<p>
+References <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00100">uint32</a>.
+<p>
+<div class="fragment"><pre>01473 {
+01474 <span class="preprocessor">#if defined (NL_OS_WINDOWS)</span>
+01475 <span class="preprocessor"></span> <span class="keyword">struct </span>_stat buf;
+01476 <span class="keywordtype">int</span> result = _fstat (fileno(f), &amp;buf);
+01477 <span class="preprocessor">#elif defined (NL_OS_UNIX)</span>
+01478 <span class="preprocessor"></span> <span class="keyword">struct </span>stat buf;
+01479 <span class="keywordtype">int</span> result = fstat (fileno(f), &amp;buf);
+01480 <span class="preprocessor">#endif</span>
+01481 <span class="preprocessor"></span> <span class="keywordflow">if</span> (result != 0) <span class="keywordflow">return</span> 0;
+01482 <span class="keywordflow">else</span> <span class="keywordflow">return</span> buf.st_size;
+01483 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CFilee13" doxytag="NLMISC::CFile::getFileSize" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> NLMISC::CFile::getFileSize </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>filename</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap><code> [static]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return the size of the file (in bytes).<p>
+You have to provide the full path of the file (the function doesn't lookup)
+<p>
+Definition at line <a class="el" href="a06167.html#l01434">1434</a> of file <a class="el" href="a06167.html">path.cpp</a>.
+<p>
+References <a class="el" href="a05981.html#l00100">uint32</a>.
+<p>
+<div class="fragment"><pre>01435 {
+01436 <span class="comment">/* FILE *fp = fopen (filename.c_str(), "rb");</span>
+01437 <span class="comment"> if (fp == NULL) return 0;</span>
+01438 <span class="comment"> nlfseek64 (fp, 0, SEEK_END);</span>
+01439 <span class="comment"> uint32 size = ftell (fp);</span>
+01440 <span class="comment"> fclose (fp);</span>
+01441 <span class="comment"> return size;*/</span>
+01442
+01443 <span class="comment">/* const char *s = filename.c_str();</span>
+01444 <span class="comment"> int h = _open (s, _O_RDONLY | _O_BINARY);</span>
+01445 <span class="comment"> _lseek (h, 0, SEEK_END);</span>
+01446 <span class="comment"> uint32 size = _tell (h);</span>
+01447 <span class="comment"> _close (h);</span>
+01448 <span class="comment"> return size;</span>
+01449 <span class="comment">*/</span>
+01450
+01451 <span class="keywordflow">if</span> (<a class="code" href="a05377.html#a2">filename</a>.find(<span class="charliteral">'@'</span>) != string::npos)
+01452 {
+01453 <a class="code" href="a04558.html#a11">uint32</a> fs = 0, bfo;
+01454 <span class="keywordtype">bool</span> c, d;
+01455 <a class="code" href="a02261.html#NLMISC_1_1CBigFilee0">CBigFile::getInstance</a>().<a class="code" href="a02261.html#NLMISC_1_1CBigFilea1">getFile</a> (filename, fs, bfo, c, d);
+01456 <span class="keywordflow">return</span> fs;
+01457 }
+01458 <span class="keywordflow">else</span>
+01459 {
+01460 <span class="preprocessor">#if defined (NL_OS_WINDOWS)</span>
+01461 <span class="preprocessor"></span> <span class="keyword">struct </span>_stat buf;
+01462 <span class="keywordtype">int</span> result = _stat (<a class="code" href="a05377.html#a2">filename</a>.c_str (), &amp;buf);
+01463 <span class="preprocessor">#elif defined (NL_OS_UNIX)</span>
+01464 <span class="preprocessor"></span> <span class="keyword">struct </span>stat buf;
+01465 <span class="keywordtype">int</span> result = stat (<a class="code" href="a05377.html#a2">filename</a>.c_str (), &amp;buf);
+01466 <span class="preprocessor">#endif</span>
+01467 <span class="preprocessor"></span> <span class="keywordflow">if</span> (result != 0) <span class="keywordflow">return</span> 0;
+01468 <span class="keywordflow">else</span> <span class="keywordflow">return</span> buf.st_size;
+01469 }
+01470 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CFilee14" doxytag="NLMISC::CFile::getLastSeparator" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int NLMISC::CFile::getLastSeparator </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>filename</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap><code> [static]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return the position between [begin,end[ of the last separator between path and filename ('/' or '\'). If there's no separator, it returns string::npos.
+<p>
+Definition at line <a class="el" href="a06167.html#l01319">1319</a> of file <a class="el" href="a06167.html">path.cpp</a>.
+<p>
+<div class="fragment"><pre>01320 {
+01321 <a class="code" href="a04558.html#a11">uint32</a> pos = <a class="code" href="a05377.html#a2">filename</a>.find_last_of (<span class="charliteral">'/'</span>);
+01322 <span class="keywordflow">if</span> (pos == string::npos)
+01323 {
+01324 pos = <a class="code" href="a05377.html#a2">filename</a>.find_last_of (<span class="charliteral">'\\'</span>);
+01325 <span class="keywordflow">if</span> (pos == string::npos)
+01326 {
+01327 pos = <a class="code" href="a05377.html#a2">filename</a>.find_last_of (<span class="charliteral">'@'</span>);
+01328 }
+01329 }
+01330 <span class="keywordflow">return</span> pos;
+01331 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CFilee15" doxytag="NLMISC::CFile::getPath" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> string NLMISC::CFile::getPath </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>filename</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap><code> [static]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Retrieve the associated file path with the trailing slash. Returns an empty string if the path is invalid
+<p>
+Definition at line <a class="el" href="a06167.html#l01361">1361</a> of file <a class="el" href="a06167.html">path.cpp</a>.
+<p>
+<div class="fragment"><pre>01362 {
+01363 <a class="code" href="a04558.html#a11">uint32</a> pos = CFile::getLastSeparator(filename);
+01364 <span class="keywordflow">if</span> (pos != string::npos)
+01365 <span class="keywordflow">return</span> <a class="code" href="a05377.html#a2">filename</a>.substr (0, pos + 1);
+01366 <span class="keywordflow">else</span>
+01367 <span class="keywordflow">return</span> <span class="stringliteral">""</span>;
+01368 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CFilee16" doxytag="NLMISC::CFile::getTemporaryOutputFilename" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void NLMISC::CFile::getTemporaryOutputFilename </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>originalFilename</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>std::string &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>tempFilename</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"><code> [static]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Get temporary output filename. Call this method to get a temporary output filename. If you have successfuly saved your data, delete the old filename and move the new one.
+<p>
+Definition at line <a class="el" href="a06167.html#l01769">1769</a> of file <a class="el" href="a06167.html">path.cpp</a>.
+<p>
+<div class="fragment"><pre>01770 {
+01771 <a class="code" href="a04558.html#a15">uint</a> i = 0;
+01772 <span class="keywordflow">do</span>
+01773 tempFilename = originalFilename+<span class="stringliteral">".tmp"</span>+<a class="code" href="a05378.html#a244">toString</a> (i++);
+01774 <span class="keywordflow">while</span> (CFile::isExists(tempFilename));
+01775 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CFilee17" doxytag="NLMISC::CFile::isDirectory" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> bool NLMISC::CFile::isDirectory </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>filename</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap><code> [static]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Just to know if it is a directory. _FileName empty and path not !!!
+<p>
+Definition at line <a class="el" href="a06167.html#l01370">1370</a> of file <a class="el" href="a06167.html">path.cpp</a>.
+<p>
+References <a class="el" href="a05646.html#l01124">num</a>, <a class="el" href="a05586.html#l00161">NLMISC::smprintf()</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00100">uint32</a>.
+<p>
+<div class="fragment"><pre>01371 {
+01372 <span class="preprocessor">#ifdef NL_OS_WINDOWS</span>
+01373 <span class="preprocessor"></span> DWORD <a class="code" href="a04223.html#a643">res</a> = GetFileAttributes(<a class="code" href="a05377.html#a2">filename</a>.c_str());
+01374 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a643">res</a> == ~0U)
+01375 {
+01376 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"PATH: %s is not a valid file / directory name"</span>, <a class="code" href="a05377.html#a2">filename</a>.c_str ());
+01377 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+01378 }
+01379 <span class="keywordflow">return</span> (<a class="code" href="a04223.html#a643">res</a> &amp; FILE_ATTRIBUTE_DIRECTORY) != 0;
+01380 <span class="preprocessor">#else // NL_OS_WINDOWS</span>
+01381 <span class="preprocessor"></span> <span class="keyword">struct </span>stat buf;
+01382 <span class="keywordtype">int</span> <a class="code" href="a04223.html#a643">res</a> = stat (<a class="code" href="a05377.html#a2">filename</a>.c_str (), &amp;buf);
+01383 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a643">res</a> == -1)
+01384 {
+01385 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"PATH: can't stat '%s' error %d '%s'"</span>, <a class="code" href="a05377.html#a2">filename</a>.c_str(), errno, strerror(errno));
+01386 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+01387 }
+01388 <span class="keywordflow">return</span> (buf.st_mode &amp; S_IFDIR) != 0;
+01389 <span class="preprocessor">#endif // NL_OS_WINDOWS</span>
+01390 <span class="preprocessor"></span>}
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CFilee18" doxytag="NLMISC::CFile::isExists" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> bool NLMISC::CFile::isExists </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>filename</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap><code> [static]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return true if the file OR directory exists. Warning: this test will also tell that the file does not exist if you don't have the rights to read it (Unix).
+<p>
+Definition at line <a class="el" href="a06167.html#l01392">1392</a> of file <a class="el" href="a06167.html">path.cpp</a>.
+<p>
+References <a class="el" href="a05646.html#l01124">num</a>.
+<p>
+<div class="fragment"><pre>01393 {
+01394 <span class="preprocessor">#ifdef NL_OS_WINDOWS</span>
+01395 <span class="preprocessor"></span> <span class="keywordflow">return</span> (GetFileAttributes(<a class="code" href="a05377.html#a2">filename</a>.c_str()) != ~0U);
+01396 <span class="preprocessor">#else // NL_OS_WINDOWS</span>
+01397 <span class="preprocessor"></span> <span class="keyword">struct </span>stat buf;
+01398 <span class="keywordflow">return</span> stat (<a class="code" href="a05377.html#a2">filename</a>.c_str (), &amp;buf) == 0;
+01399 <span class="preprocessor">#endif // NL_OS_WINDOWS</span>
+01400 <span class="preprocessor"></span>}
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CFilee19" doxytag="NLMISC::CFile::moveFile" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> bool NLMISC::CFile::moveFile </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dest</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>src</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"><code> [static]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Move a file NB this keeps file attributes
+<p>
+Definition at line <a class="el" href="a06167.html#l01658">1658</a> of file <a class="el" href="a06167.html">path.cpp</a>.
+<p>
+References <a class="el" href="a05646.html#l00645">size</a>.
+<p>
+<div class="fragment"><pre>01659 {
+01660 <span class="keywordflow">return</span> <a class="code" href="a05378.html#a344">CopyMoveFile</a>(dest, src, <span class="keyword">false</span>);
+01661 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CFilee20" doxytag="NLMISC::CFile::removeFileChangeCallback" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void NLMISC::CFile::removeFileChangeCallback </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>filename</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap><code> [static]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Remove a file that was previously added by addFileChangeCallback
+<p>
+Definition at line <a class="el" href="a06167.html#l01549">1549</a> of file <a class="el" href="a06167.html">path.cpp</a>.
+<p>
+References <a class="el" href="a06167.html#l01547">NLMISC::FileToCheck</a>.
+<p>
+<div class="fragment"><pre>01550 {
+01551 string fn = CPath::lookup(filename, <span class="keyword">false</span>, <span class="keyword">false</span>);
+01552 <span class="keywordflow">if</span> (fn.empty())
+01553 {
+01554 fn = <a class="code" href="a05377.html#a2">filename</a>;
+01555 }
+01556 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i = 0; i &lt; <a class="code" href="a05378.html#a32">FileToCheck</a>.size(); i++)
+01557 {
+01558 <span class="keywordflow">if</span>(<a class="code" href="a05378.html#a32">FileToCheck</a>[i].FileName == fn)
+01559 {
+01560 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"PATH: CFile::removeFileChangeCallback: '%s' is removed from checked files modification"</span>, fn.c_str());
+01561 <a class="code" href="a05378.html#a32">FileToCheck</a>.erase(<a class="code" href="a05378.html#a32">FileToCheck</a>.begin()+i);
+01562 <span class="keywordflow">return</span>;
+01563 }
+01564 }
+01565 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CFilee21" doxytag="NLMISC::CFile::setRWAccess" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> bool NLMISC::CFile::setRWAccess </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>filename</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap><code> [static]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Try to set the file access to read/write if not already set. return true if the file doesn't exists or if the file already have RW access. Work actually only on Windows and returns always true on other platforms. <dl compact><dt><b>Returns:</b></dt><dd>true if RW access is granted</dd></dl>
+
+<p>
+Definition at line <a class="el" href="a06167.html#l01720">1720</a> of file <a class="el" href="a06167.html">path.cpp</a>.
+<p>
+References <a class="el" href="a05622.html#l00135">nlwarning</a>, and <a class="el" href="a05646.html#l01119">res</a>.
+<p>
+<div class="fragment"><pre>01721 {
+01722 <span class="preprocessor">#ifdef NL_OS_WINDOWS</span>
+01723 <span class="preprocessor"></span> <span class="comment">// if the file exists and there's no write access</span>
+01724 <span class="keywordflow">if</span> (_access (<a class="code" href="a05377.html#a2">filename</a>.c_str(), 00) == 0 &amp;&amp; _access (<a class="code" href="a05377.html#a2">filename</a>.c_str(), 06) == -1)
+01725 {
+01726 <span class="comment">// try to set the read/write access</span>
+01727 <span class="keywordflow">if</span> (_chmod (<a class="code" href="a05377.html#a2">filename</a>.c_str(), _S_IREAD | _S_IWRITE) == -1)
+01728 {
+01729 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"PATH: Can't set RW access to file '%s': %d %s"</span>, <a class="code" href="a05377.html#a2">filename</a>.c_str(), errno, strerror(errno));
+01730 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+01731 }
+01732 }
+01733 <span class="preprocessor">#else</span>
+01734 <span class="preprocessor"></span> <span class="comment">// if the file exists and there's no write access</span>
+01735 <span class="keywordflow">if</span> (access (<a class="code" href="a05377.html#a2">filename</a>.c_str(), F_OK) == 0)
+01736 {
+01737 <span class="comment">// try to set the read/write access</span>
+01738 <span class="keywordflow">if</span> (chmod (<a class="code" href="a05377.html#a2">filename</a>.c_str(), S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH) == -1)
+01739 {
+01740 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"PATH: Can't set RW access to file '%s': %d %s"</span>, <a class="code" href="a05377.html#a2">filename</a>.c_str(), errno, strerror(errno));
+01741 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+01742 }
+01743 }
+01744 <span class="keywordflow">else</span>
+01745 {
+01746 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"PATH: Can't access to file '%s'"</span>, <a class="code" href="a05377.html#a2">filename</a>.c_str());
+01747 }
+01748 <span class="preprocessor">#endif</span>
+01749 <span class="preprocessor"></span> <span class="keywordflow">return</span> <span class="keyword">true</span>;
+01750 }
+</pre></div> </td>
+ </tr>
+</table>
+<hr>The documentation for this struct was generated from the following files:<ul>
+<li><a class="el" href="a06168.html">path.h</a><li><a class="el" href="a06167.html">path.cpp</a></ul>
+<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 13:12:52 2004 for NeL by
+<a href="http://www.doxygen.org/index.html">
+<img src="doxygen.png" alt="doxygen" align="middle" border=0 >
+</a>1.3.6 </small></address>
+</body>
+</html>