<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: find-file code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Tue, 07 Oct 2008 10:51:06 GMT</pubDate>
    <description>DZone Snippets: find-file code</description>
    <item>
      <title>Find a file in a list of dirs</title>
      <link>http://snippets.dzone.com/posts/show/1280</link>
      <description>&lt;code&gt;&lt;br /&gt;    find-file: func [&lt;br /&gt;        {Based on an idea by Sunanda. Find a file in one of the specified&lt;br /&gt;        dirs and return it, fully qualified.}&lt;br /&gt;        dirs [block!]&lt;br /&gt;        file [file!]&lt;br /&gt;        /local normalize-dir normalize-file path&lt;br /&gt;    ][&lt;br /&gt;        normalize-dir: func [&lt;br /&gt;            "Remove any leading slashes, ensure a trailing slash"&lt;br /&gt;            dir&lt;br /&gt;        ][&lt;br /&gt;            while [#"/" = first dir] [remove dir]&lt;br /&gt;            to-file dirize dir&lt;br /&gt;        ]&lt;br /&gt;&lt;br /&gt;        normalize-file: func [&lt;br /&gt;            "Remove any leading slashes"&lt;br /&gt;            file&lt;br /&gt;        ][&lt;br /&gt;            while [#"/" = first file] [remove file]&lt;br /&gt;            to-file file&lt;br /&gt;        ]&lt;br /&gt;&lt;br /&gt;        foreach dir dirs [&lt;br /&gt;            path: join what-dir normalize-dir form dir&lt;br /&gt;            if exists? result: join path normalize-file file [return result]&lt;br /&gt;        ]&lt;br /&gt;    ]&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 23 Jan 2006 02:04:36 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1280</guid>
      <author>gregg.irwin (Gregg Irwin)</author>
    </item>
    <item>
      <title>Find a file in a list of dirs</title>
      <link>http://snippets.dzone.com/posts/show/1278</link>
      <description>&lt;code&gt;&lt;br /&gt;    find-file: func [&lt;br /&gt;        {Based on an idea by Sunanda. Find a file in one of the specified&lt;br /&gt;        dirs and return it, fully qualified.}&lt;br /&gt;        dirs [block!]&lt;br /&gt;        file [file!]&lt;br /&gt;        /local normalize-dir normalize-file path&lt;br /&gt;    ][&lt;br /&gt;        normalize-dir: func [&lt;br /&gt;            "Remove any leading slashes, ensure a trailing slash"&lt;br /&gt;            dir&lt;br /&gt;        ][&lt;br /&gt;            while [#"/" = first dir] [remove dir]&lt;br /&gt;            to-file dirize dir&lt;br /&gt;        ]&lt;br /&gt;&lt;br /&gt;        normalize-file: func [&lt;br /&gt;            "Remove any leading slashes"&lt;br /&gt;            file&lt;br /&gt;        ][&lt;br /&gt;            while [#"/" = first file] [remove file]&lt;br /&gt;            to-file file&lt;br /&gt;        ]&lt;br /&gt;&lt;br /&gt;        foreach dir dirs [&lt;br /&gt;            path: join what-dir normalize-dir form dir&lt;br /&gt;            if exists? result: join path normalize-file file [return result]&lt;br /&gt;        ]&lt;br /&gt;    ]&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 23 Jan 2006 02:04:00 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1278</guid>
      <author>gregg.irwin (Gregg Irwin)</author>
    </item>
    <item>
      <title>Find a file in a list of dirs</title>
      <link>http://snippets.dzone.com/posts/show/1277</link>
      <description>&lt;code&gt;&lt;br /&gt;    find-file: func [&lt;br /&gt;        {Based on an idea by Sunanda. Find a file in one of the specified&lt;br /&gt;        dirs and return it, fully qualified.}&lt;br /&gt;        dirs [block!]&lt;br /&gt;        file [file!]&lt;br /&gt;        /local normalize-dir normalize-file path&lt;br /&gt;    ][&lt;br /&gt;        normalize-dir: func [&lt;br /&gt;            "Remove any leading slashes, ensure a trailing slash"&lt;br /&gt;            dir&lt;br /&gt;        ][&lt;br /&gt;            while [#"/" = first dir] [remove dir]&lt;br /&gt;            to-file dirize dir&lt;br /&gt;        ]&lt;br /&gt;&lt;br /&gt;        normalize-file: func [&lt;br /&gt;            "Remove any leading slashes"&lt;br /&gt;            file&lt;br /&gt;        ][&lt;br /&gt;            while [#"/" = first file] [remove file]&lt;br /&gt;            to-file file&lt;br /&gt;        ]&lt;br /&gt;&lt;br /&gt;        foreach dir dirs [&lt;br /&gt;            path: join what-dir normalize-dir form dir&lt;br /&gt;            if exists? result: join path normalize-file file [return result]&lt;br /&gt;        ]&lt;br /&gt;    ]&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 23 Jan 2006 02:03:38 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1277</guid>
      <author>gregg.irwin (Gregg Irwin)</author>
    </item>
  </channel>
</rss>
