Browse Source

Update & improve.

Martijn Laan 2 months ago
parent
commit
35f18727c8
3 changed files with 31 additions and 13 deletions
  1. 19 11
      ISHelp/ispp.xml
  2. 4 2
      ISHelp/isxfunc.xml
  3. 8 0
      whatsnew.htm

+ 19 - 11
ISHelp/ispp.xml

@@ -1661,9 +1661,12 @@ The first group of options (<tt>option</tt>) controls the general options, while
 					</pre>
 					</pre>
 				</section>
 				</section>
 				<description>
 				<description>
-					<p>Returns the directory portion of the given filename with a backslash. If PathName doesn't contain a directory portion, the result is an empty string.</p>
+					<p>Returns the directory portion of the given filename, including a trailing backslash. If PathName doesn't contain a directory portion, the result is an empty string.</p>
           <p>Declared in &builtins;.</p>
           <p>Declared in &builtins;.</p>
 				</description>
 				</description>
+				<section title="See also">
+					<p><tt><link href="ExtractFileDir">ExtractFileDir</link></tt></p>
+				</section>
 			</topic>
 			</topic>
 			<topic id="ExtractFileDir">
 			<topic id="ExtractFileDir">
 				<title>ExtractFileDir</title>
 				<title>ExtractFileDir</title>
@@ -1673,9 +1676,12 @@ The first group of options (<tt>option</tt>) controls the general options, while
 					</pre>
 					</pre>
 				</section>
 				</section>
 				<description>
 				<description>
-					<p>Returns the directory portion of the given filename without a backslash (unless it is a root directory). If PathName doesn't contain a directory portion, the result is an empty string.</p>
+					<p>Returns the directory portion of the given filename, excluding a trailing backslash (unless it is a root directory). If PathName doesn't contain a directory portion, the result is an empty string.</p>
           <p>Declared in &builtins;.</p>
           <p>Declared in &builtins;.</p>
 				</description>
 				</description>
+				<section title="See also">
+					<p><tt><link href="ExtractFilePath">ExtractFilePath</link></tt></p>
+				</section>
 			</topic>
 			</topic>
 			<topic id="ExtractFileExt">
 			<topic id="ExtractFileExt">
 				<title>ExtractFileExt</title>
 				<title>ExtractFileExt</title>
@@ -1737,11 +1743,11 @@ The first group of options (<tt>option</tt>) controls the general options, while
           <p>Declared in &builtins;.</p>
           <p>Declared in &builtins;.</p>
 				</description>
 				</description>
 			</topic>
 			</topic>
-			<topic id="RemoveBackslash">
-				<title>RemoveBackslash</title>
+			<topic id="RemoveBackslashUnlessRoot">
+				<title>RemoveBackslashUnlessRoot</title>
 				<section title="Prototype">
 				<section title="Prototype">
 					<pre>
 					<pre>
-						<line><b>str</b> RemoveBackslash(<b>str</b> S)</line>
+						<line><b>str</b> RemoveBackslashUnlessRoot(<b>str</b> S)</line>
 					</pre>
 					</pre>
 				</section>
 				</section>
 				<description>
 				<description>
@@ -2000,15 +2006,16 @@ The first group of options (<tt>option</tt>) controls the general options, while
 		<topic id="predefinedvars">
 		<topic id="predefinedvars">
 				<keywords>
 				<keywords>
 					<kwd>__COUNTER__</kwd>
 					<kwd>__COUNTER__</kwd>
-					<kwd>__FILE__</kwd>
+					<kwd>__FILENAME__</kwd>
 					<kwd>__INCLUDE__</kwd>
 					<kwd>__INCLUDE__</kwd>
 					<kwd>__LINE__</kwd>
 					<kwd>__LINE__</kwd>
 					<kwd>__OPT_X__</kwd>
 					<kwd>__OPT_X__</kwd>
+					<kwd>__DIR__</kwd>
 					<kwd>__PATHFILENAME__</kwd>
 					<kwd>__PATHFILENAME__</kwd>
 					<kwd>__POPT_X__</kwd>
 					<kwd>__POPT_X__</kwd>
 					<kwd>__WIN32__</kwd>
 					<kwd>__WIN32__</kwd>
 					<kwd>ISPP_INVOKED</kwd>
 					<kwd>ISPP_INVOKED</kwd>
-					<kwd>ISPPCC_INVOKED</kwd>
+					<kwd>ISCC_INVOKED</kwd>
 					<kwd>PREPROCVER</kwd>
 					<kwd>PREPROCVER</kwd>
 					<kwd>WINDOWS</kwd>
 					<kwd>WINDOWS</kwd>
 					<kwd>UNICODE</kwd>
 					<kwd>UNICODE</kwd>
@@ -2023,20 +2030,21 @@ The first group of options (<tt>option</tt>) controls the general options, while
 				<p>There are a number of predefined variables provided ISPP:</p>
 				<p>There are a number of predefined variables provided ISPP:</p>
 				<table>
 				<table>
 					<tr><td><code>__COUNTER__</code></td><td><code><b>int</b></code>. Automatically increments each time it is used (afterwards).</td></tr>
 					<tr><td><code>__COUNTER__</code></td><td><code><b>int</b></code>. Automatically increments each time it is used (afterwards).</td></tr>
-					<tr><td><code>__FILE__</code></td><td><code><b>str</b></code>. Returns the name of the current file. Empty string for the root file.</td></tr>
+					<tr><td><code>__FILENAME__</code></td><td><code><b>str</b></code>. Similar to __PATHFILENAME__, but returns only the filename portion.</td></tr>
 					<tr><td><code>__INCLUDE__</code></td><td><code><b>str</b></code>. Returns the current include path (or paths delimited with semicolons) set via <code>#pragma include</code>.</td></tr>
 					<tr><td><code>__INCLUDE__</code></td><td><code><b>str</b></code>. Returns the current include path (or paths delimited with semicolons) set via <code>#pragma include</code>.</td></tr>
 					<tr><td><code>__LINE__</code></td><td><code><b>int</b></code>. Returns the number of the line in the current file.</td></tr>
 					<tr><td><code>__LINE__</code></td><td><code><b>int</b></code>. Returns the number of the line in the current file.</td></tr>
 					<tr><td><code>__OPT_X__</code></td><td><code><b>void</b></code>. Defined if specified option set via <code>#pragma option -x+</code> is in effect. In place of "X" may be any letter from "A" to "Z." Use <link href="defined">Defined</link> function to test whether the variable is defined.</td></tr>
 					<tr><td><code>__OPT_X__</code></td><td><code><b>void</b></code>. Defined if specified option set via <code>#pragma option -x+</code> is in effect. In place of "X" may be any letter from "A" to "Z." Use <link href="defined">Defined</link> function to test whether the variable is defined.</td></tr>
-					<tr><td><code>__PATHFILENAME__</code></td><td><code><b>str</b></code>. Similar to __FILE__, but returns the full pathname of the file. Empty string for the root file.</td></tr>
+					<tr><td><code>__DIR__</code></td><td><code><b>str</b></code>. Similar to __PATHFILENAME__, but returns only the directory portion, excluding a trailing backslash (unless it is a root directory).</td></tr>
+					<tr><td><code>__PATHFILENAME__</code></td><td><code><b>str</b></code>. Returns the full path of the current include file. Empty string for the root script file.</td></tr>
 					<tr><td><code>__POPT_X__</code></td><td><code><b>void</b></code>. Defined if specified parser option set via <code>#pragma parseroption -x+</code> is in effect. In place of "X" may be any letter from "A" to "Z." Use <link href="defined">Defined</link> function to test whether the variable is defined.</td></tr>
 					<tr><td><code>__POPT_X__</code></td><td><code><b>void</b></code>. Defined if specified parser option set via <code>#pragma parseroption -x+</code> is in effect. In place of "X" may be any letter from "A" to "Z." Use <link href="defined">Defined</link> function to test whether the variable is defined.</td></tr>
 					<tr><td><code>__WIN32__</code></td><td><code><b>void</b></code>. Always defined.</td></tr>
 					<tr><td><code>__WIN32__</code></td><td><code><b>void</b></code>. Always defined.</td></tr>
 					<tr><td><code>ISPP_INVOKED</code></td><td><code><b>void</b></code>. Always defined.</td></tr>
 					<tr><td><code>ISPP_INVOKED</code></td><td><code><b>void</b></code>. Always defined.</td></tr>
-					<tr><td><code>ISPPCC_INVOKED</code></td><td><code><b>void</b></code>. Defined if compilation was invoked using the console-mode compiler, ISCC.exe.</td></tr>
+					<tr><td><code>ISCC_INVOKED</code></td><td><code><b>void</b></code>. Defined if compilation was invoked using the console-mode compiler, ISCC.exe.</td></tr>
 					<tr><td><code>PREPROCVER</code></td><td><code><b>int</b></code>. Returns the 32-bit encoded version of ISPP. Highest byte holds the major version, lowest byte holds the build number.</td></tr>
 					<tr><td><code>PREPROCVER</code></td><td><code><b>int</b></code>. Returns the 32-bit encoded version of ISPP. Highest byte holds the major version, lowest byte holds the build number.</td></tr>
 					<tr><td><code>WINDOWS</code></td><td><code><b>void</b></code>. Always defined.</td></tr>
 					<tr><td><code>WINDOWS</code></td><td><code><b>void</b></code>. Always defined.</td></tr>
 					<tr><td><code>UNICODE</code></td><td><code><b>void</b></code>. Always defined.</td></tr>
 					<tr><td><code>UNICODE</code></td><td><code><b>void</b></code>. Always defined.</td></tr>
 					<tr><td><code>CompilerPath</code></td><td><code><b>str</b></code>. Points to the directory where the compiler is located.</td></tr>
 					<tr><td><code>CompilerPath</code></td><td><code><b>str</b></code>. Points to the directory where the compiler is located.</td></tr>
-					<tr><td><code>SourcePath</code></td><td><code><b>str</b></code>. Points to the directory where the current script is located, or the My Documents directory if the script has not yet been saved.</td></tr>
+					<tr><td><code>SourcePath</code></td><td><code><b>str</b></code>. Points to the directory where the root script file is located, or the My Documents directory if the script has not yet been saved.</td></tr>
 					<tr><td><code>Ver</code></td><td><code><b>int</b></code>. Returns the 32-bit encoded version of Inno Setup compiler. Highest byte holds the major version, lowest byte the minor version.</td></tr>
 					<tr><td><code>Ver</code></td><td><code><b>int</b></code>. Returns the 32-bit encoded version of Inno Setup compiler. Highest byte holds the major version, lowest byte the minor version.</td></tr>
 					<tr><td><code>NewLine</code></td><td><code><b>str</b></code>. Returns the newline character. Declared in &builtins;.</td></tr>
 					<tr><td><code>NewLine</code></td><td><code><b>str</b></code>. Returns the newline character. Declared in &builtins;.</td></tr>
 					<tr><td><code>Tab</code></td><td><code><b>str</b></code>. Returns the tab character. Declared in &builtins;.</td></tr>
 					<tr><td><code>Tab</code></td><td><code><b>str</b></code>. Returns the tab character. Declared in &builtins;.</td></tr>

+ 4 - 2
ISHelp/isxfunc.xml

@@ -1082,12 +1082,14 @@ end;</pre></example>
       <function>
       <function>
         <name>ExtractFileDir</name>
         <name>ExtractFileDir</name>
         <prototype>function ExtractFileDir(const FileName: String): String;</prototype>
         <prototype>function ExtractFileDir(const FileName: String): String;</prototype>
-        <description><p>Extracts the drive and directory parts of the given file name. The resulting string is empty if FileName contains no drive and directory parts.</p></description>
+        <description><p>Extracts the drive and directory parts of the given file name, excluding a trailing backslash (unless it is a root directory). The resulting string is empty if FileName contains no drive and directory parts.</p></description>
+        <seealso><p><link topic="isxfunc_ExtractFilePath">ExtractFilePath</link></p></seealso>
       </function>
       </function>
       <function>
       <function>
         <name>ExtractFilePath</name>
         <name>ExtractFilePath</name>
         <prototype>function ExtractFilePath(const FileName: String): String;</prototype>
         <prototype>function ExtractFilePath(const FileName: String): String;</prototype>
-        <description><p>Extracts the drive and directory parts of the given file name. The resulting string is the leftmost characters of FileName, up to and including the colon or backslash that separates the path information from the name and extension. The resulting string is empty if FileName contains no drive and directory parts.</p></description>
+        <description><p>Extracts the drive and directory parts of the given file name, including a trailing backslash. The resulting string is the leftmost characters of FileName, up to and including the colon or backslash that separates the path information from the name and extension. The resulting string is empty if FileName contains no drive and directory parts.</p></description>
+        <seealso><p><link topic="isxfunc_ExtractFileDir">ExtractFileDir</link></p></seealso>
       </function>
       </function>
       <function>
       <function>
         <name>ExtractFileName</name>
         <name>ExtractFileName</name>

+ 8 - 0
whatsnew.htm

@@ -132,6 +132,14 @@ issigtool --key-file="MyKey.ispublickey" verify "MyProg.dll"</pre>
 <ul>
 <ul>
   <li>Compiler IDE: the <i>Find in Files</i> result list will now update its line numbers when you add or delete lines.</li>
   <li>Compiler IDE: the <i>Find in Files</i> result list will now update its line numbers when you add or delete lines.</li>
   <li><tt>[Files]</tt> section parameter <tt>Excludes</tt> can now be combined with the <tt>external</tt> flag.</li>
   <li><tt>[Files]</tt> section parameter <tt>Excludes</tt> can now be combined with the <tt>external</tt> flag.</li>
+  <li>ISPP changes:
+    <ul>
+      <li>Added predefined variable <tt>__DIR__</tt>. Returns the directory of the current include file.</li>
+      <li>Renamed predefined variables <tt>__FILE__</tt> to <tt>__FILENAME__</tt> and <tt>ISPPCC_INVOKED</tt> to <tt>ISCC_INVOKED</tt>. The old names still work.</li>
+      <li>Renamed support function <tt>RemoveBackslash</tt> to <tt>RemoveBackslashUnlessRoot</tt>. The old name still works.</li>
+      <li><i>Fix:</i> The return value of support function <tt>ExtractFilePath</tt> did not always including a trailing backslash as intended.</li>
+    </ul>
+  </li>
   <li>Pascal Scripting change: Added new <tt>GetSHA256OfStream</tt> support function.</li>
   <li>Pascal Scripting change: Added new <tt>GetSHA256OfStream</tt> support function.</li>
   <li>All translations which still had a UTF-8 BOM had their BOM removed. Using a BOM in UTF-8 encoded files is not needed and not recommended since Inno Stup 6.3.0.</li>
   <li>All translations which still had a UTF-8 BOM had their BOM removed. Using a BOM in UTF-8 encoded files is not needed and not recommended since Inno Stup 6.3.0.</li>
   <li>Documentation improvements.</li>
   <li>Documentation improvements.</li>