Forums > Java

Patch Path on load

February 18, 2006 | 10:16 pm

Hi,
The following code won’t work if the mxj is loaded at the same time the patch file is opened:

//gets the path of the mxj’s parent patcher
private void patchPath()
{
_patcher = this.getParentPatcher();
_patchPath = _patcher.getFilePath().substring(0, _patcher.getFilePath().lastIndexOf(‘/’) + 1);
}

You get "" as the path. If you reinitialize the mxj once the patch is loaded, then it works. Are there any plans to fix this? I’m tempted to file a bug report about this.

thanks,
wes


February 20, 2006 | 6:46 pm

This is not necessarily specific to mxj.
Could you fix the problem by putting that code in
a loadbang method? This is called after the patch is loaded.

public void loadbang()

Topher


February 20, 2006 | 7:35 pm

Ah, Yes I could. Right now I’ve got it hidden in an if statement when
I receive the first input, which is super ugly. I always forget that
mxj has a loadbang method.

thanks,
wes


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