Forums > MaxMSP

relative paths

May 1, 2006 | 12:45 pm

Hey guys,

does anyone know how to set up relative paths that aren’t within the max application folder? i want to select a folder that is in the same level as my patch and read the relative path, so i just get the folder name rather than the absolute path?

please help.

cheers

dave


May 1, 2006 | 2:35 pm

path-> [thispatcher]

use [sprintf %ssubfolder/subsubfolder] to concat the rest of the folderpath.

best, thijs


May 1, 2006 | 2:43 pm

ok i might missunderstand something and in that case please excuse me in
advance.
Did you have a look at the objects relativepath absolutepath and filepath ?

Sorry if my answer if too simple, maybe i got something wrong.
HTH.
Seb.T


May 1, 2006 | 2:54 pm

yeh i have,

but the object relativepath only works for within the max application program. so im having a bit of difficulty trying to just get a relative path from the main folder.

any ideas?
dave


May 1, 2006 | 3:03 pm

hi thijs,

here is what i have…sorry i couldn’t figure out how/where to put in your suggested object

#P button 35 11 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 45 276 26 9109513 print;
#P newex 87 366 28 9109513 dac~;
#P message 148 246 14 9109513 0;
#P message 131 246 14 9109513 1;
#N sfplay~ 2 120960 0 ;
#P newobj 88 295 48 9109513 sfplay~ 2;
#P user dropfile 88 -39 193 -1 1;
#P window linecount 2;
#P comment 91 -34 100 9109513 drag and drop a file/folder here…;
#P window linecount 1;
#P newex 88 173 64 9109513 prepend open;
#P newex 88 119 64 9109513 sprintf %s%s;
#P newex 88 85 84 9109513 append 01-01.wav;
#P message 88 54 261 9109513 E:/University/FINALBASIC/Patches_media/media/;
#P newex 88 18 60 9109513 prepend set;
#P connect 7 1 10 1;
#P fasten 8 0 7 0 136 280 93 280;
#P fasten 9 0 7 0 153 280 93 280;
#P connect 2 0 3 0;
#P connect 0 0 1 0;
#P connect 12 0 1 0;
#P connect 6 0 0 0;
#P connect 7 0 10 0;
#P connect 1 0 2 0;
#P connect 3 0 4 0;
#P connect 4 0 7 0;
#P connect 4 0 11 0;
#P window clipboard copycount 13;

Im trying just to get the relative path.

hope you can help?

cheers,
dave


May 4, 2006 | 1:30 pm

javascript is good for sorting this kind of thing out:

appFilePath = "";

post("path: " +this.patcher.filepath);

var tmp = this.patcher.filepath.split("/");

post("Filepath: "+ this.patcher.filepath + "n");

if (tmp[tmp.length-1] != "MacOS") tmp.pop(); //remove patcher name

for(var c=0; c
{
appFilePath += tmp[c] + "/";
}

newFilePath = appFilePath + "yourDirectory/";


May 4, 2006 | 2:14 pm

you cant get relative paths that way.

if you have

/harddisk/maxmsp/searchpath/

and

/harddisk/file.txt

there is no relative path between max runtime
and the file because it would include going
2 levels up.
if you want to build an app which uses a "samples"
folder relative beside the app, you could
incluide a "samples" folder in your search path
during programming.


Viewing 7 posts - 1 through 7 (of 7 total)