<doc>
	<legacy_id>2483</legacy_id>
	<name>revMacFromUnixPath</name>
	<type>function</type>

	<syntax>
		<example>revMacFromUnixPath(<i>unixPathname</i>[,<i>convertOSX</i>])</example>
	</syntax>

	<synonyms>
	</synonyms>

	<summary>Converts a Unix-style <glossary tag="file path">pathname</glossary> to a <glossary tag="Mac OS">Mac OS</glossary>-style <glossary tag="file path">pathname</glossary>. </summary>

	<examples>
<example>revMacFromUnixPath(&quot;/usr/bin/stuff&quot;) </example>
<example>revMacFromUnixPath(it)</example>
	</examples>

	<history>
		<introduced version="1.0">Added. </introduced>
		<deprecated version=""></deprecated>
		<removed version=""></removed>
		<changed version="2.1.1">2.1.1</changed>
	</history>

	<objects>
	</objects>

	<platforms>
		<mac/>
		<windows/>
		<linux/>
	</platforms>

	<classes>
		<desktop/>
		<server/>
		<web/>
	</classes>

	<security>
	</security>


	<classification>
		<category>Files, Folders, &amp; Resources</category>
		<category>Standalone Applications</category>
	</classification>

	<references>
		<command tag="answer file">answer file Command</command>
	</references>

	<description>
	<overview>Use the <b>revMacFromUnixPath</b> <control_st tag="function">function</control_st> to convert a LiveCode-style <glossary tag="file path">file path</glossary> to the <glossary tag="Mac OS">Mac OS</glossary> <glossary tag="file path">file path</glossary> format (for example, if you need to pass a <glossary tag="file path">pathname</glossary> to an <glossary tag="external">external</glossary>). </overview>

	<parameters>
		<parameter>The <i>unixPathname</i> is a file or folder pathname in the standard format used by LiveCode for file paths.</parameter>
    <parameter>The <i>convertOSX</i> is true or false. If you don't specify the <i>convertOSX</i>, if OS X is running, LiveCode assumes you want to convert an OS X-style path to a Mac OS-style path; otherwise, it assumes you don't want to convert between the OS X style and Mac OS style.</parameter>
	</parameters>

	<value>The <b>revMacFromUnixPath</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>. </value>
	<comments>The <b>revMacFromUnixPath</b> <control_st tag="function">function</control_st> converts slashes (/) to colons (:), the folder-level <glossary tag="delimiter">delimiter</glossary> for <glossary tag="Mac OS">Mac OS</glossary> <glossary tag="file path">pathnames</glossary>. It also deletes leading slashes, so that <glossary tag="file path">pathnames</glossary> are rooted in the volume name (the standard for <glossary tag="Mac OS">Mac OS</glossary> <glossary tag="file path">pathnames</glossary>). It also adjusts relative pathnames. <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 &quot;Volumes&quot;, followed by the disk name. </p><p></p><p>The OS X path convention is used by LiveCode, but the old Mac OS-style path convention is required 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>revMacFromUnixPath</b> <control_st tag="function">function</control_st> automatically converts <glossary tag="absolute file path">absolute paths</glossary> from the <glossary tag="OS X">OS X</glossary> standard to the <glossary tag="Mac OS">Mac OS</glossary> standard, adding the startup disk's name to paths that are on the startup disk, and stripping the &quot;Volumes&quot; element from paths that are not on the startup disk. If the <i>convertOSX</i> is false, the <b>revMacFromUnixPath</b> <control_st tag="function">function</control_st> does not make these changes to <glossary tag="absolute file path">absolute paths</glossary>. </p><p></p><p>LiveCode always uses the Unix pathname standard for cross-platform compatibility, and automatically converts pathnames to the correct standard for the current platform when executing commands. 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><p></p><note>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>revMacFromUnixPath</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>revMacFromUnixPath</b> <control_st tag="function">function</control_st> can be used in any <glossary tag="handler">handler</glossary>. </note><p></p><p></p><change><p>The <i>convertOSX</i> <glossary tag="parameter">parameter</glossary> was introduced in version 2.1.1. In previous versions, the <b>revMacFromUnixPath</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.</change></comments>
	</description>
</doc>