<doc>
  <legacy_id>2359</legacy_id>
  <name>defaultFolder</name>
  <type>property</type>
  <syntax>
    <example>set the defaultFolder to <i>folderPath</i></example>
  </syntax>
  <library></library>
  <objects>
    <global/>
  </objects>
  <synonyms>
    <synonym>folder</synonym>
    <synonym>directory</synonym>
  </synonyms>
  <classification>
    <category>Files, Folders, &amp; Resources</category>
    <category>Standalone Applications</category>
  </classification>
  <references>
    <command tag="revSetDatabaseDriverPath">revSetDatabaseDriverPath Command</command>
    <command tag="create alias">create alias Command</command>
  </references>
  <history>
    <introduced version="1.0">Added.</introduced>
  </history>
  <platforms>
    <mac/>
    <windows/>
    <linux/>
    <ios/>
    <android/>
  </platforms>
  <classes>
    <desktop/>
    <server/>
    <web/>
    <mobile/>
  </classes>
  <security>
  </security>
  <summary>Specifies the <property tag="defaultFolder">folder</property> that is used by the <function tag="files">files</function> and <function tag="folders">folders</function> <glossary tag="function">functions</glossary> and by <glossary tag="command">commands</glossary> that manipulate <function tag="files">files</function>.</summary>
  <examples>
    <example>set the defaultFolder to "/Hard Disk/Applications/GetIt"</example>
    <example>set the defaultFolder to it</example>
  </examples>
  <description>
    <p>Use the <b>defaultFolder</b> to perform <keyword tag="file">file</keyword> manipulations on <function tag="files">files</function> in the same <property tag="defaultFolder">folder</property> without having to include the <glossary tag="absolute file path">full path</glossary>.</p><p/><p><b>Value:</b></p><p>The <b>defaultFolder</b> is a <keyword tag="string">string</keyword> consisting of a valid <glossary tag="file path">path</glossary> to a <property tag="defaultFolder">folder</property>.</p><p/><p>When a LiveCode application starts up, the <b>defaultFolder</b> initially contains whatever the working directory was at the time the application was launched. Typically this is the folder that the application resides in, however this is not always the case and shouldn't be relied on. It is best always to set the <b>defaultFolder</b> before using relative paths.</p><p/><p>When you start up the application via a <b>file association</b> (eg by launching a document you have chosen to link to your application using "Open With..." on Windows or by dragging the document onto the application icon on OS X ) then the defaultFolder is set to the folder containing the document being launched. </p><p/><p><b>Comments:</b></p><p>The <b>defaultFolder</b> <glossary tag="property">property</glossary> specifies the <property tag="defaultFolder">folder</property> LiveCode uses as the <glossary tag="current folder">current directory</glossary> when resolving <glossary tag="relative file path">relative paths</glossary> (except for <glossary tag="relative file path">relative paths</glossary> specified in the <property tag="stackFiles">stackFiles</property> <glossary tag="property">property</glossary>).</p><p/><p>If you specify a file without giving its full path, LiveCode looks for the file in the <b>defaultFolder</b>. If you specify a <glossary tag="relative file path">relative path</glossary>, the <b>defaultFolder</b> is <glossary tag="prepend">prepended</glossary> to it to create the <glossary tag="absolute file path">full path</glossary>.</p><p/><p>If you set the <b>defaultFolder</b> to a <property tag="defaultFolder">folder</property> that doesn't exist, the <function tag="result">result</function> is set to "can't open directory" and the <function tag="value">value</function> of the <b>defaultFolder</b> does not change.</p><p/><p>You cannot delete the current <b>defaultFolder</b>.</p><p/><p><img src="202653"/> <b>Important!</b> The <i>folderPath</i> is specified using <glossary tag="Unix">Unix</glossary> conventions, even on <glossary tag="Mac OS">Mac OS</glossary> and <function tag="openStacks">Windows</function> systems. The names of <function tag="folders">folders</function> are separated with a "/" character, and <glossary tag="absolute file path">absolute paths</glossary> (starting with a disk or partition name) must begin with a "/" character.</p>
  </description>
</doc>