| Author |
Message |
Plasticman
Joined: Feb 25, 2008 Posts: 11 Location: Ireland
|
Posted: Wed Apr 09, 2008 5:34 am Post subject:
Directories in ChucK |
 |
|
When using Machine.add(), does it use the chuck file's parent directory, or the binary's? I tried to launch a file in a subdirectory with the code below, and the VM reported that the file did not exist.
| Code: | | Machine.add("./Modules/ModManager.ck"); |
edit: Could it be because I'm running Windows? The /example/shred/machine.ck example didn't work either. |
|
|
Back to top
|
|
 |
Kassen
Janitor


Joined: Jul 06, 2004 Posts: 6718 Location: The Hague, NL
G2 patch files: 3
|
Posted: Wed Apr 09, 2008 6:54 am Post subject:
|
 |
|
Actually, ChucK uses a path relative to the directory from which it was called. That may be the location of the executable, but likely it isn't as likely you put the executable in your path (copying it to /windows/system32/ will do).
If this is a problem you can use the full path in the file-name like;
Machine.add( "d:/chuck/myfiles/drums/snare.ck" );
I recommend using relative paths so you can easily move and distribute your code but this may not always be convenient.
Note that the MiniAudicle has a setting in it's menu to indicate the directory to work from, since it's a graphical application it's location in the directory tree isn't very meaningful most of the time.
Hope that helps. _________________ Modern technology offers an endless field day to any deviant strains in our personalities. --J.G.Ballard |
|
|
Back to top
|
|
 |
Inventor

Joined: Oct 13, 2007 Posts: 1700 Location: Florida, USA
Audio files: 67
|
Posted: Wed Apr 09, 2008 6:56 am Post subject:
|
 |
|
Hmmm, I would try:
| Code: | | Machine.add("Modules/ModManager.ck"); |
leaving off the "./" at the beginning. Though I really don't know if that would work. ChucK itself should use the directory from which you launched it, and the miniAudicle has a place in the preferences where you can specify the directory. If the above suggestion doesn't work, try looking at this and other path examples in the docs. Good luck. _________________ For those about to ChucK, we salute you! - Ge Wang
Let's make noise for peace! - kijjaz |
|
|
Back to top
|
|
 |
Plasticman
Joined: Feb 25, 2008 Posts: 11 Location: Ireland
|
Posted: Wed Apr 09, 2008 11:34 am Post subject:
|
 |
|
| I was trying to run it from miniAudicle, once I used the command line it worked fine. Thanks! |
|
|
Back to top
|
|
 |
Kassen
Janitor


Joined: Jul 06, 2004 Posts: 6718 Location: The Hague, NL
G2 patch files: 3
|
Posted: Wed Apr 09, 2008 11:42 am Post subject:
|
 |
|
In that case you may want to check the MIni's settings for the starting directory. I think it's in the last tab of the settings. _________________ Modern technology offers an endless field day to any deviant strains in our personalities. --J.G.Ballard |
|
|
Back to top
|
|
 |
kijjaz

Joined: Sep 20, 2004 Posts: 568 Location: bangkok, thailand
Audio files: 2
|
Posted: Wed Apr 09, 2008 11:49 am Post subject:
|
 |
|
| or do we need to replace / with \ on windows? |
|
|
Back to top
|
|
 |
Plasticman
Joined: Feb 25, 2008 Posts: 11 Location: Ireland
|
Posted: Wed Apr 09, 2008 11:50 am Post subject:
|
 |
|
| No, ChucK reads \ as an escape character. |
|
|
Back to top
|
|
 |
|