<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.spheredev.org/index.php?action=history&amp;feed=atom&amp;title=API%3AFS.relativePath</id>
		<title>API:FS.relativePath - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.spheredev.org/index.php?action=history&amp;feed=atom&amp;title=API%3AFS.relativePath"/>
		<link rel="alternate" type="text/html" href="http://wiki.spheredev.org/index.php?title=API:FS.relativePath&amp;action=history"/>
		<updated>2026-04-24T09:02:15Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.29.0</generator>

	<entry>
		<id>http://wiki.spheredev.org/index.php?title=API:FS.relativePath&amp;diff=10140&amp;oldid=prev</id>
		<title>Bruce Pascoe at 18:37, 18 August 2017</title>
		<link rel="alternate" type="text/html" href="http://wiki.spheredev.org/index.php?title=API:FS.relativePath&amp;diff=10140&amp;oldid=prev"/>
				<updated>2017-08-18T18:37:49Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 18:37, 18 August 2017&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{DISPLAYTITLE:FS.relativePath()}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{DISPLAYTITLE:FS.relativePath()}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The '''&amp;lt;tt&amp;gt;FS.relativePath()&amp;lt;/tt&amp;gt;''' function computes an abbreviated path for a specified file or directory.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The '''&amp;lt;tt&amp;gt;FS.relativePath()&amp;lt;/tt&amp;gt;''' &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[[API:Functions|Core API]] &lt;/ins&gt;function computes an abbreviated path for a specified file or directory.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===== Usage =====&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===== Usage =====&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Bruce Pascoe</name></author>	</entry>

	<entry>
		<id>http://wiki.spheredev.org/index.php?title=API:FS.relativePath&amp;diff=10139&amp;oldid=prev</id>
		<title>Bruce Pascoe: Add FS.relativePath() page</title>
		<link rel="alternate" type="text/html" href="http://wiki.spheredev.org/index.php?title=API:FS.relativePath&amp;diff=10139&amp;oldid=prev"/>
				<updated>2017-08-18T18:32:23Z</updated>
		
		<summary type="html">&lt;p&gt;Add FS.relativePath() page&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{DISPLAYTITLE:FS.relativePath()}}&lt;br /&gt;
&lt;br /&gt;
The '''&amp;lt;tt&amp;gt;FS.relativePath()&amp;lt;/tt&amp;gt;''' function computes an abbreviated path for a specified file or directory.&lt;br /&gt;
&lt;br /&gt;
===== Usage =====&lt;br /&gt;
&lt;br /&gt;
 ''rel_path'' = '''FS.relativePath'''(''file_or_dir_name''[, ''base_dir_name'']);&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== API Information ==&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;tt&amp;gt;FS.relativePath()&amp;lt;/tt&amp;gt;''' takes a file or directory name and returns an abbreviated version relative to a specified base directory.  This is useful when logging or displaying filenames where the full path might be too verbose.&lt;br /&gt;
&lt;br /&gt;
If the [[SphereFS]] prefixes of the (canonicalized) input path and base directory differ, then the full pathname is returned without attempting to abbreviate it.  This ensures that one can always recover the original path by doing:&lt;br /&gt;
&lt;br /&gt;
 rel_path = FS.relativePath(path, base_dir);&lt;br /&gt;
 /* ... */&lt;br /&gt;
 path = FS.fullPath(rel_path, base_dir);&lt;br /&gt;
&lt;br /&gt;
=== Parameters ===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Name&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|''&amp;lt;tt&amp;gt;file_or_dir_name&amp;lt;/tt&amp;gt;''&lt;br /&gt;
|style=&amp;quot;text-align: center;&amp;quot;|''string''&lt;br /&gt;
|&lt;br /&gt;
|The name of a file or directory, resolved per SphereFS rules (relative to &amp;lt;tt&amp;gt;@/&amp;lt;/tt&amp;gt;).  It doesn't need to actually exist.&lt;br /&gt;
|-&lt;br /&gt;
|''&amp;lt;tt&amp;gt;base_dir_name&amp;lt;/tt&amp;gt;''&lt;br /&gt;
|style=&amp;quot;text-align: center;&amp;quot;|''string''&lt;br /&gt;
|&lt;br /&gt;
|Specifies the base directory for the relative path.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Return Value ===&lt;br /&gt;
&lt;br /&gt;
An abbreviated version of &amp;lt;tt&amp;gt;''file_or_dir_name''&amp;lt;/tt&amp;gt; relative to the specified base directory.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;&lt;br /&gt;
* [[API:FS.fullPath|FS.fullPath()]]&lt;br /&gt;
&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Sphere 2 API]]&lt;/div&gt;</summary>
		<author><name>Bruce Pascoe</name></author>	</entry>

	</feed>