<?xml version="1.0" encoding="UTF-8"?>
	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"

			>

	<channel>
		<title>Cycling 74  &#187;  Topic: Relative paths in externals and objects</title>
		<atom:link href="http://cycling74.com/forums/topic/relative-paths-in-externals-and-objects/feed" rel="self" type="application/rss+xml" />
		<link>http://cycling74.com/forums/topic/relative-paths-in-externals-and-objects/feed</link>
		<description></description>
		<pubDate>Tue, 18 Jun 2013 21:51:11 +0000</pubDate>
		<generator>http://bbpress.org/?v=2.2.4</generator>
		<language></language>

		
														
					
				<item>
					<guid>http://cycling74.com/forums/topic/relative-paths-in-externals-and-objects/#post-25002</guid>
					<title><![CDATA[Relative paths in externals and objects]]></title>
					<link>http://cycling74.com/forums/topic/relative-paths-in-externals-and-objects/#post-25002</link>
					<pubDate>Tue, 21 Mar 2006 19:48:22 +0000</pubDate>
					<dc:creator>Rodrigo Cadiz</dc:creator>

					<description>
						<![CDATA[
						<p>Hi everyone. I just wrote an external for MaxMSP for OSX (Mach-0)<br />
using flext in C++. The external reads data from a text file on disc<br />
and then creates appropriate inlets, outlets, etc. The argument to my<br />
external is the filename path.</p>
<p>Here is my question. If I type a path relative to where my Patch is,<br />
it doesn&#8217;t work. Let&#8217;s say I have a patch called MyPatch.mxb that<br />
contains my external called MyExternal. If the text file is in the<br />
same folder as my external this doesn&#8217;t work:</p>
<p>MyExternal MyTextFile.txt</p>
<p>or</p>
<p>MyExternal ./MyTextFile.txt</p>
<p>
It works with an absolute path though, like</p>
<p>MyExternal /Users/myaccount/MyPatches/MyTextFile.txt</p>
<p>I&#8217;ve discovered it works from a path relative to the Max/MSP folder.<br />
So, something like</p>
<p>MyExternal ../../Users/myaccount/MyPatches/MyTextFile.txt</p>
<p>works ok because the MaxMSP program is in /Applications/MaxMSP4.5</p>
<p>So, it seems that for MaxMSP the current path is where the application<br />
resides and not where the opened patches are. That&#8217;s weird to me, but<br />
not really a problem.</p>
<p>BUT, there are plenty of externals and max objects that do work with a<br />
path relative to the patch and not the application, like buffer~</p>
<p>You can do buffer~ mysoundfile.wav and this works if the soundfile is<br />
in the same folder where your patch is. How is this achieved? Is the<br />
path &#8220;reset&#8221; or converted to a path relative to the application inside<br />
the object&#8217;s code?</p>
<p>Evidently I am missing something here.</p>
<p>Thanks for your help.</p>
<p>Rodrigo</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/relative-paths-in-externals-and-objects/#post-72990</guid>
					<title><![CDATA[Re: Relative paths in externals and objects]]></title>
					<link>http://cycling74.com/forums/topic/relative-paths-in-externals-and-objects/#post-72990</link>
					<pubDate>Tue, 21 Mar 2006 20:23:53 +0000</pubDate>
					<dc:creator>Joshua Kit Clayton</dc:creator>

					<description>
						<![CDATA[
						<p>Max ./ paths are not relative tot the patch. They are relative to the <br />
application. There is no mechanism for patch relative paths at this time <br />
as it requires a major overhaul of the API, which won&#8217;t happen until at <br />
least the next major release. For now, it must be accomplished by the <br />
user from the patcher using the thispatcher&#8217;s path output.</p>
<p>The patcher&#8217;s path is included in the search path at load, so filenames <br />
without a preceding &#8220;./&#8221; will owrk while loading the patch, but not <br />
necessarily after the patch has loaded.</p>
<p>-Joshua</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/relative-paths-in-externals-and-objects/#post-72991</guid>
					<title><![CDATA[Re: Relative paths in externals and objects]]></title>
					<link>http://cycling74.com/forums/topic/relative-paths-in-externals-and-objects/#post-72991</link>
					<pubDate>Tue, 21 Mar 2006 23:20:08 +0000</pubDate>
					<dc:creator>Rodrigo Cadiz</dc:creator>

					<description>
						<![CDATA[
						<p>But, then, how is that buffer~ works even after the patch has loaded?</p>
<p>Rodrigo</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/relative-paths-in-externals-and-objects/#post-72992</guid>
					<title><![CDATA[Re: Relative paths in externals and objects]]></title>
					<link>http://cycling74.com/forums/topic/relative-paths-in-externals-and-objects/#post-72992</link>
					<pubDate>Tue, 21 Mar 2006 23:50:45 +0000</pubDate>
					<dc:creator>Joshua Kit Clayton</dc:creator>

					<description>
						<![CDATA[
						<p>
On Mar 21, 2006, at 3:20 PM, Rodrigo Cadiz wrote:</p>
<p>> But, then, how is that buffer~ works even after the patch has loaded?</p>
<p>It doesn&#8217;t necessarily. It will only work as long as you don&#8217;t change  <br />
the current default folder (e.g. opening a fileopen dialog and  <br />
choosing file from another folder), or open another patcher in a  <br />
different folder.</p>
<p>Note that you need to use locatefile_extended() to get the path of  <br />
files specified by name alone.</p>
<p>Btw, if you need more assistance with using the max provided API for  <br />
finding and opening files, it&#8217;s probably better suited for the  <br />
developer&#8217;s forum/mailing list.</p>
<p>-Joshua</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/relative-paths-in-externals-and-objects/#post-72993</guid>
					<title><![CDATA[Re: Relative paths in externals and objects]]></title>
					<link>http://cycling74.com/forums/topic/relative-paths-in-externals-and-objects/#post-72993</link>
					<pubDate>Wed, 22 Mar 2006 02:27:59 +0000</pubDate>
					<dc:creator>Davis Pyon</dc:creator>

					<description>
						<![CDATA[
						<p>You could try something like this in your object_new() function:</p>
<p>x->defaultPathID = path_getdefault();<br />
path_topathname(x->defaultPathID, NULL, tmpStr);<br />
path_nameconform(tmpStr, x->defaultPathname, PATH_STYLE_NATIVE,<br />
                 PATH_TYPE_ABSOLUTE);</p>
<p>x->defaultPathname will contain the absolute pathname of<br />
the patch that contains your object.  With some string manipulation, you can form the absolute pathname to the file.  <br />
Or, you could use chdir() (or _chdir() on win) right before you open the file.  As long as your patches are outside of Max&#8217;s search path, it should work.  If you place your patches in Max&#8217;s search path, then this method will only work if it&#8217;s located in one of the<br />
topmost directories (such as the MaxMSP application folder).</p>
<p>Davis</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/relative-paths-in-externals-and-objects/#post-72994</guid>
					<title><![CDATA[Re: Relative paths in externals and objects]]></title>
					<link>http://cycling74.com/forums/topic/relative-paths-in-externals-and-objects/#post-72994</link>
					<pubDate>Wed, 22 Mar 2006 02:29:45 +0000</pubDate>
					<dc:creator>Davis Pyon</dc:creator>

					<description>
						<![CDATA[
						<p>> x->defaultPathname will contain the absolute pathname of<br />
> the patch that contains your object. </p>
<p>Woops.  I mean the absolute pathname of the directory that<br />
contains the patch that contains your object.</p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

