<doc>
  <legacy_id>1409</legacy_id>
  <name>revUnixFromMacPath</name>
  <type>function</type>
  <syntax>
    <example>revUnixFromMacPath(<i>macPathname</i>[,<i>convertOSX</i>])</example>
  </syntax>
  <library>Common library</library>
  <objects>
  </objects>
  <synonyms>
  </synonyms>
  <classification>
    <category>Files, Folders, &amp; Resources</category>
    <category>Standalone Applications</category>
  </classification>
  <references>
    <command tag="answer file">answer file Command</command>
  </references>
  <history>
    <introduced version="1.0">Added.</introduced>
    <changed version="2.1.1"></changed>
  </history>
  <platforms>
    <mac/>
    <windows/>
    <linux/>
  </platforms>
  <classes>
    <desktop/>
    <server/>
    <web/>
  </classes>
  <security>
  </security>
  <summary>Converts a <glossary tag="Mac OS">Mac OS</glossary>-style <glossary tag="file path">pathname</glossary> to a <glossary tag="Unix">Unix</glossary>-style <glossary tag="file path">pathname</glossary>.</summary>
  <examples>
    <example>revUnixFromMacPath("Disk:Folder:") <code><i>-- returns "/Disk/Folder/"</i></code></example>
    <example>answer file revUnixFromMacPath(someXFCN())</example>
    <example>put revUnixFromMacPath(myValue,true)</example>
  </examples>
  <description>
    <p>Use the <b>revUnixFromMacPath</b> <control_st tag="function">function</control_st> to convert a <glossary tag="Mac OS">Mac OS</glossary>-style file path to the LiveCode <glossary tag="file path">file path</glossary> format (for example, to convert a <glossary tag="file path">pathname</glossary> returned by an XFCN).</p><p/><p><b>Parameters:</b></p><p>The <i>macPathname</i> is a <keyword tag="file">file</keyword> or <property tag="defaultFolder">folder</property> <glossary tag="file path">pathname</glossary> in the format used by the <glossary tag="Mac OS">Mac OS</glossary> for <glossary tag="file path">file paths</glossary>.</p><p/><p><b>Value:</b></p><p>The <b>revUnixFromMacPath</b> <control_st tag="function">function</control_st> returns a <keyword tag="string">string</keyword> with the <glossary tag="file path">file path</glossary> in the format expected by the <glossary tag="Mac OS">Mac OS</glossary>.</p><p/><p>The <i>convertOSX</i> is true or false. If you don't specify the <i>convertOSX</i>, if <glossary tag="OS X">OS X</glossary> is running, LiveCode assumes the <i>macPathname</i> is an <glossary tag="OS X">OS X</glossary>-style path to a <glossary tag="Mac OS">Mac OS</glossary>-style path; otherwise, it assumes the <i>macPathname</i> is a <glossary tag="Mac OS">Mac OS</glossary>-style path.</p><p/><p><b>Comments:</b></p><p>The <b>revUnixFromMacPath</b> <control_st tag="function">function</control_st> converts colons (:) to slashes (/), the folder-level <glossary tag="delimiter">delimiter</glossary> for <glossary tag="Unix">Unix</glossary> <glossary tag="file path">pathnames</glossary>. It also adjusts <glossary tag="relative file path">relative paths</glossary> and <glossary tag="absolute file path">absolute paths</glossary> to be in <glossary tag="Unix">Unix</glossary> standard form.</p><p/><p>On Mac OS systems, absolute paths always begin with the name of the disk that the file or folder is on. On OS X systems, the startup disk's name does not appear in absolute file paths. Instead, if a file or folder is on the startup disk, the first part of the file path is the top-level folder that the file is in. If a file or folder is on a disk other than the startup disk, its absolute path starts with "Volumes", followed by the disk name.</p><p/><p>The OS X path convention is used by LiveCode, but the old Mac OS-style path convention is used by certain applications (such as AppleScript), even on OS X systems. If the <i>convertOSX</i> is true (or if you don't specify the <i>convertOSX</i> and the application is running under <glossary tag="OS X">OS X</glossary>), the <b>revUnixFromMacPath</b> <control_st tag="function">function</control_st> assumes that <glossary tag="absolute file path">absolute paths</glossary> are using the <glossary tag="OS X">OS X</glossary> convention. If the <i>convertOSX</i> is false, the <b>revUnixFromMacPath</b> <control_st tag="function">function</control_st> assumes that absolute paths use the <glossary tag="Mac OS">Mac OS</glossary> convention.</p><p/><p>LiveCode always uses the Unix pathname standard for cross-platform compatibility. You need to convert the pathname only if you are passing it to another program or external. If you are using only LiveCode commands and functions, you do not need to convert the pathname, since LiveCode does it for you.</p><p/><p><code/><b>Note:</b><code/> When included in a <glossary tag="standalone application">standalone application</glossary>, the <glossary tag="Common library">Common library</glossary> is implemented as a hidden <command tag="group">group</command> and made available when the <command tag="group">group</command> receives its first <message tag="openBackground">openBackground</message> message. During the first part of the <glossary tag="application">application's</glossary> startup process, before this <keyword tag="message box">message</keyword> is sent, the <b>revUnixFromMacPath</b> <control_st tag="function">function</control_st> is not yet available. This may affect attempts to use this <control_st tag="function">function</control_st> in <message tag="startup">startup</message>, <message tag="preOpenStack">preOpenStack</message>, <message tag="openStack">openStack</message>, or <message tag="preOpenCard">preOpenCard</message> <glossary tag="handler">handlers</glossary> in the <glossary tag="main stack">main stack</glossary>. Once the <glossary tag="application">application</glossary> has finished starting up, the <command tag="start using">library</command> is available and the <b>revUnixFromMacPath</b> <control_st tag="function">function</control_st> can be used in any <glossary tag="handler">handler</glossary>.</p><p/><p><b>Changes:</b></p><p>The <i>convertOSX</i> <glossary tag="parameter">parameter</glossary> was introduced in version 2.1.1. In previous versions, the <b>revUnixFromMacPath</b> <control_st tag="function">function</control_st> did not attempt to convert between the <glossary tag="Mac OS">Mac OS</glossary> and <glossary tag="OS X">OS X</glossary> conventions described above.</p>
  </description>
</doc>