6d2decb78e45379a8b503588df9727568a79ecde
[scilab.git] / scilab / modules / fileio / help / en_US / pathconvert.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) 2008 - INRIA
5  * ...
6  * 
7  * This file must be used under the terms of the CeCILL.
8  * This source file is licensed as described in the file COPYING, which
9  * you should have received as part of this distribution.  The terms
10  * are also available at    
11  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
12  *
13  -->
14 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:lang="en" xml:id="pathconvert">
15     <refnamediv>
16         <refname>pathconvert</refname>
17         <refpurpose> pathnames convertion between POSIX and Windows.  </refpurpose>
18     </refnamediv>
19     <refsynopsisdiv>
20         <title>Calling Sequence</title>
21         <synopsis>paths = pathconvert(paths [,flagtrail [,flagexpand [,type]]])</synopsis>
22     </refsynopsisdiv>
23     <refsection>
24         <title>Arguments</title>
25         <variablelist>
26             <varlistentry>
27                 <term>paths</term>
28                 <listitem>
29                     <para>a string matrix giving a set of pathnames</para>
30                 </listitem>
31             </varlistentry>
32             <varlistentry>
33                 <term>flagtrail</term>
34                 <listitem>
35                     <para>
36                         a boolean optional parameter. Its default value is <constant>%t</constant>.
37                     </para>
38                 </listitem>
39             </varlistentry>
40             <varlistentry>
41                 <term>flagexpand</term>
42                 <listitem>
43                     <para>
44                         a boolean optional parameter. Its default value depends on the result of <code>getos() == 'Windows'</code>.
45                     </para>
46                 </listitem>
47             </varlistentry>
48             <varlistentry>
49                 <term>type</term>
50                 <listitem>
51                     <para>
52                         a string <literal>'u'</literal> or <literal>'w'</literal>.
53                     </para>
54                 </listitem>
55             </varlistentry>
56         </variablelist>
57     </refsection>
58     <refsection>
59         <title>Description</title>
60         <para>
61             <function>pathconvert</function> can be used to convert a set of pathnames
62             (given by a string matrix <varname>paths</varname>) from Windows native 
63             filename to POSIX-style pathnames and back. The target style 
64             is given by the optional string <varname>type</varname> which can be 
65             <literal>'u'</literal> for Unix or <literal>'w'</literal> for Windows. The default 
66             style is set according to the value of <code>getos() == 'Windows'</code>. 
67             If <code>getos() == 'Windows'</code> is <constant>%t</constant> (resp. <constant>%f</constant> ) then default type is <literal>'w'</literal>
68             (resp.  <literal>'u'</literal>).
69         </para>
70         <para>
71             Windows pathnames starting with <literal>name:</literal> are converted to 
72             pathnames starting with <literal>/cygdrive/name/</literal> using the cygwin 
73             convention.
74         </para>
75         <para>
76             <varname>flagtrail</varname> is an optional boolean parameter. When its value 
77             is <constant>%t</constant> (default value) a trailing separator (<literal>'\'</literal> or <literal>'/'</literal>) is added 
78             at the end of the path if it was missing.  If <varname>flagtrail</varname> is
79             set to <constant>%f</constant>, the trailing separator is removed.
80         </para>
81         <para>
82             <varname>flagexpand</varname> is an optional boolean parameter. When its value 
83             is <constant>%t</constant> leading strings like  <varname>HOME</varname>, <varname>SCI</varname> or <literal>~</literal> are 
84             expanded using environment variables.
85         </para>
86     </refsection>
87     <refsection>
88         <title>Examples</title>
89         <programlisting role="example"><![CDATA[ 
90 pathconvert("SCI/modules/fileio\macros/foo.sci",%f,%f,"u")
91 pathconvert("SCI/modules/fileio\macros/foo.sci",%f,%f,"w")
92 pathconvert("SCI/modules/fileio/macros/foo.sci",%f,%t,"w")
93 pathconvert("HOME/modules/fileio/macros/foo.sci",%t,%t,"w")
94 pathconvert("c:/tmp",%f,%t,"u")
95 pathconvert("/cygdrive/c/tmp",%f,%f,"w")
96  ]]></programlisting>
97     </refsection>
98     <refsection role="see also">
99         <title>See Also</title>
100         <simplelist type="inline">
101             <member>
102                 <link linkend="basename">basename</link>
103             </member>
104             <member>
105                 <link linkend="listfiles">listfiles</link>
106             </member>
107         </simplelist>
108     </refsection>
109 </refentry>