locating audio files

Started by Daroepfin, December 24, 2005, 06:23:08

Previous topic - Next topic

Daroepfin

The WaveData class, when instanciated, looks for audio relative to the classpath, and that's kinda lame... I want to make it look 'absolutely', or relative to the working directory. I tried feeding it an absolute path and it didn't work.

Anybody have some advice?

Cheers
Jeff

oNyx

Relative to the classpath and relative to the working directory is the same (the former is a superset of the latter).

Well, use leading slashes (like "/sfx/blam.wav") for making it relative from the root of the classpath.

Daroepfin

Yeah, the workaround is easy, just not very elegant since netbeans has a weird place for putting my class files, which I feel I shouldn't need to worry about. I set it up to use a specific working directory, but LWJGL doesn't use that.

Oh, and so I don't the working directory is in the classpath necessarily...

It would be nice if WaveData took a location relative to the working directory, or if it could take an absolute address, or if it took a File as input.

~Jeff

oNyx

Its not a workaround. Its the proper way to do it.

Using files or absolute pathes would be an ugly hack, which would break outside of your building system. Dont do that.

Just add the resouce dir to the classpath (for the run bit) and use pathes with leading slashes. Thats all.