<doc>
  <legacy_id>2509</legacy_id>
  <name>getResources</name>
  <type>function</type>
  <syntax>
    <example>getResources(<i>filePath</i>[,<i>resourceType</i>])</example>
  </syntax>
  <library></library>
  <objects>
  </objects>
  <synonyms>
  </synonyms>
  <classification>
    <category>Files, Folders, &amp; Resources</category>
  </classification>
  <references>
    <function tag="setResource">setResource Function</function>
  </references>
  <history>
    <introduced version="1.0">Added.</introduced>
    <changed version="1.1"></changed>
  </history>
  <platforms>
    <mac/>
  </platforms>
  <classes>
    <desktop/>
    <web/>
  </classes>
  <security>
    <disk access="???"/>
  </security>
  <summary><glossary tag="return">Returns</glossary> a list of the <glossary tag="resource">resources</glossary> in a <glossary tag="Mac OS">Mac OS</glossary> <keyword tag="file">file</keyword>.</summary>
  <examples>
    <example>getResources("Project Resources")</example>
    <example>getResources(it,"STR#")</example>
  </examples>
  <description>
    <p>Use the <b>getResources</b> <control_st tag="function">function</control_st> to find out whether a <glossary tag="resource">resource</glossary> already exists before using it or copying it.</p><p/><p><b>Parameters:</b></p><p>The <i>filePath</i> is the location and name of the <keyword tag="file">file</keyword> whose <glossary tag="resource fork">resource fork</glossary> you want to list. If you specify a name but not a location, LiveCode assumes the <keyword tag="file">file</keyword> is in the <property tag="defaultFolder">defaultFolder</property>.</p><p/><p>The <i>resourceType</i> is the 4-character type of the <glossary tag="resource">resources</glossary> you want to list. If you don't specify a <i>resourceType</i>, the <b>getResources</b> function lists all the <glossary tag="resource">resources</glossary> of all resource types.</p><p/><p><b>Value:</b></p><p>The <b>getResources</b> <control_st tag="function">function</control_st> <glossary tag="return">returns</glossary> a list of <glossary tag="resource">resources</glossary>, one per <keyword tag="line">line</keyword>. Each <keyword tag="line">line</keyword> consists of four <keyword tag="items">items</keyword>:</p><p>        * the 4-character resource type</p><p>        * the resource ID</p><p>        * the resource name</p><p>        * the resource size in bytes</p><p>        * one or more resource flag characters. The possible resource flags are as follows:</p><p><b>S       </b>System heap</p><p><b>U       </b>Purgeable</p><p><b>L</b>       Locked</p><p><b>P</b>       Protected</p><p><b>R</b>       Preload</p><p><b>C</b>       Compressed resource</p><p>If a flag is set to true, its character is included in the last item. If the flag is set to false, its character is not included. If none of these flags is set for a resource, the last item of that resource's line is empty.</p><p/><p>If the file does not contain any resources, the <b>getResources</b> <control_st tag="function">function</control_st> <glossary tag="return">returns</glossary> empty.</p><p/><p><b>Comments:</b></p><p>If the <i>filePath</i> does not exist, the <function tag="result">result</function> is set to "<code>can't find file</code>". If the <i>filePath</i> exists, but the <keyword tag="file">file</keyword> has no <glossary tag="resource fork">resource fork</glossary>, the <function tag="result">result</function> is set to "<code>can't open resource fork</code>".</p><p/><p>If the file has a resource fork but no <glossary tag="resource">resources</glossary>, the <function tag="result">result</function> is empty.</p><p/><p><b>Changes:</b></p><p>The order of items returned by the <b>getResources</b> <control_st tag="function">function</control_st> was changed in version 1.1. In previous versions, the <b>getResources</b> <control_st tag="function">function</control_st> <glossary tag="return">returned</glossary> these <keyword tag="items">items</keyword> for each <glossary tag="resource">resource</glossary>:</p><p>        * the resource name</p><p>        * the resource ID</p><p>        * the 4-character resource type</p><p>        * the resource size in bytes</p><p>The resource flags item of the return value was introduced in version 1.1. In previous versions, the resource flags were not available.</p>
  </description>
</doc>