mirror of
https://github.com/boostorg/filesystem.git
synced 2025-05-12 05:31:49 +00:00
134 lines
6.0 KiB
HTML
134 lines
6.0 KiB
HTML
<html>
|
||
|
||
<head>
|
||
<meta http-equiv="Content-Language" content="en-us">
|
||
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
|
||
<meta name="ProgId" content="FrontPage.Editor.Document">
|
||
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
|
||
<title>Portability Guide</title>
|
||
</head>
|
||
|
||
<body bgcolor="#FFFFFF">
|
||
|
||
<h1>
|
||
<img border="0" src="../../../c++boost.gif" align="center" width="277" height="86">Portability
|
||
Guide</h1>
|
||
<h2>Introduction</h2>
|
||
<p>Like any other C++ program which performs I/O operations, there is no
|
||
guarantee that a program using the Filesystem Library will be portable between
|
||
operating systems. The file and directory names in paths present a particularly
|
||
troublesome portability problem.</p>
|
||
<p>It is not possible to know in advance if a file or directory name will be
|
||
valid (and thus portable) for an operating system whose requirements are
|
||
unknown. There is always the possibility that an operating system could use
|
||
names which are unusual (number between 17 and 4095, for example) or very
|
||
limited (maximum of two character names, for example).</p>
|
||
<p>It is possible, however, to know if a name is valid for a particular
|
||
operating system. It is also possible to construct names which are very
|
||
likely to be portable to a large number of modern and legacy operating systems.</p>
|
||
<p>By providing name validity checking facilities, the Filesystem Library allows
|
||
programmers to ensure that a given name meets the requirements for specific
|
||
operating systems, or meets the recommendations for general portability.</p>
|
||
<p><b>To do:</b> An implementation should be required to provide check functions
|
||
for the host O/S, and for the portability recommendations. But it isn't
|
||
possible to require implementors to supply an open ended number of checking
|
||
functions. It would be helpful if there was a registry to ensure that checking
|
||
functions for a particular O/S had the same specification regardless of
|
||
implementor.</p>
|
||
|
||
<h2>Limits imposed by specific operating systems</h2>
|
||
<p>(To be supplied)</p>
|
||
<table border="1" cellpadding="5">
|
||
<tr>
|
||
<td align="center"><b>Operating<br>
|
||
system</b></td>
|
||
<td align="center"><b>Check<br>
|
||
function</b></td>
|
||
<td align="center"><b>Requirements</b></td>
|
||
</tr>
|
||
</table>
|
||
<h2>File and directory name <a name="recommendations">recommendations</a></h2>
|
||
|
||
<p>(Very preliminary draft)</p>
|
||
|
||
<table border="1">
|
||
<tr>
|
||
<td align="center" valign="top"><strong>Recommendation</strong></td>
|
||
<td align="center" valign="top"><strong>Check<br>
|
||
function</strong></td>
|
||
<td align="center" valign="top"><strong>Rationale</strong></td>
|
||
</tr>
|
||
<tr>
|
||
<td valign="top">Limit file and directory names to the characters A-Z, a-z, 0-9, period, hyphen, and
|
||
underscore.<br>
|
||
<br>
|
||
For even greater portability, don't use hyphens at all.</td>
|
||
<td valign="top"> </td>
|
||
<td valign="top">These are the characters specified by the POSIX standard for portable directory and
|
||
file names, and are also valid for Windows, Mac, and many other modern filesystems.
|
||
ISO-9660, and possibly some legacy systems, do not permit hyphens at all.</td>
|
||
</tr>
|
||
<tr>
|
||
<td valign="top">Do not use periods in directory names. </td>
|
||
<td valign="top"> </td>
|
||
<td valign="top">Requirement for Requirement for ISO-9660, OpenVMS native
|
||
filesystem, and other legacy systems.</td>
|
||
</tr>
|
||
<tr>
|
||
<td valign="top">Do not use more that one period in a file name.</td>
|
||
<td valign="top"> </td>
|
||
<td valign="top">Requirement for ISO-9660, OpenVMS native filesystem, and
|
||
other legacy systems. </td>
|
||
</tr>
|
||
<tr>
|
||
<td valign="top">Do not use period, hyphen, or underscore as the first
|
||
character of a file or directory name.</td>
|
||
<td valign="top"> </td>
|
||
<td valign="top">Some operating systems treat have special rules for the
|
||
first character of names. POSIX, for example.</td>
|
||
</tr>
|
||
<tr>
|
||
<td valign="top">Do not assume names are case sensitive. For example, do not expected a directory to be
|
||
able to hold separate elements named "Foo" and "foo". </td>
|
||
<td valign="top"> </td>
|
||
<td valign="top">Some filesystems are case insensitive. For example, Windows
|
||
NTFS is case preserving in the way it stores names, but case insensitive in
|
||
searching for names (unless running under the POSIX sub-system, it which
|
||
case it does case sensitive searches). </td>
|
||
</tr>
|
||
<tr>
|
||
<td valign="top">Do not assume names are case insensitive. For example, do not expect a file
|
||
created with the name of "Foo" to be open successfully with the name of "foo".</td>
|
||
<td valign="top"> </td>
|
||
<td valign="top">Some filesystems are case sensitive. For example, POSIX.</td>
|
||
</tr>
|
||
<tr>
|
||
<td valign="top">Limit the length of names and the depth of the directory
|
||
tree so that the total length of the string returned by generic_path() to
|
||
255 characters.
|
||
Note that ISO 9660 level 1 has an explicit directory tree depth limit of 8.</td>
|
||
<td valign="top"> </td>
|
||
<td valign="top">Some operating systems place limits on the total path length. For example,
|
||
Windows 2000 limits paths to 260 characters total length.</td>
|
||
</tr>
|
||
<tr>
|
||
<td valign="top">Limit the length of any one name in a path. Pick the specific limit according to
|
||
the operating systems you wish portability to:<br>
|
||
Greater than 31 characters: POSIX, Windows, MAC OS X.<br>
|
||
31 characters: Classic Mac OS<br>
|
||
8 characters + period + 3 characters: ISO 9660 (CD-ROM)<br>
|
||
<strong>...</strong></td>
|
||
<td valign="top"> </td>
|
||
<td valign="top">Limiting name length can markedly reduce the expressiveness of file names, yet placing
|
||
only very high limits on lengths inhibits wide portability.</td>
|
||
</tr>
|
||
</table>
|
||
|
||
<hr>
|
||
<p><EFBFBD> Copyright Beman Dawes, 2002</p>
|
||
<p>Revised
|
||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->13 September, 2002<!--webbot bot="Timestamp" endspan i-checksum="39336" --></p>
|
||
|
||
</body>
|
||
|
||
</html> |