How to get the current directory

Jun 28, 2007 at 4:29pm

How to get the current directory

Hello Everyone,

I need to get somehow the directory where the current patcher (the one
containing my mxj object) is stored (I have an xml with default settings
for my object, and I would like to place this in the same directory as
the Max patch itself). Using System.getProperty(“user.dir”), I get the
root folder of my filesystem (I’m on OS X 10.4.10) if executed from mxj,
while in Eclipse I get the current runtime folder (as expected). Is
there some mxj-specific solution for this? Also, is there any mxj method
to get the current Max/MSP installation path?

Thank you,
Adam

________________
Siska Ádám
+36 (70) 207-63-85

http://apocalypse.rulez.org/~sadam

#32669
Jun 28, 2007 at 6:36pm

#107885
Jun 10, 2011 at 1:25pm

a “filepath” object with “default” argument

#107886
Jun 14, 2011 at 9:03am

The previews one don’t work.
This seems to be the way

– Pasted Max Patch, click to expand. –
#107887
Jan 20, 2012 at 8:40am

Thanks sandoval31 – one of the things I was looking for!

#107888
Oct 16, 2012 at 3:33pm

This is too late to be useful to the OP, but I think the answer he/she wanted was something along these lines (untested).

public class MyMaxObject extends MaxObject{

  public MyMaxObject(){
    String mainPatcherPath = this.getParentPatcher().getFilePath();
    post(mainPatcherPath); // prints the location of the patcher containing the mxj object
  }
}
#107889

You must be logged in to reply to this topic.