Posted 25 December 2012 - 09:31 AM
It took me a fair amount of mucking about to get mounting files with the peripheral to work, but eventually I did. The basic process I settled on:
-On mod load, export the lua files from my mod's zip to a fixed directory. Normal file routines don't seem to like paths into zip files, but I was able to do through the main mod class, in my case BioLock, using BioLock.class.getClassLoader().getResourceAsStream(luaFilePath). Then I just copied from this stream to an output stream with the desired path.
-on peripheral attach, through the IComputerAccess object, with "computer.mountFixedDir("rom/programs/biolock", sourcePath, true, 0);"
If you're not using the new beta of the CC API (linked in the first post of the beta 1.48 thread in the beta subforum), you'll still see a form of mountFixedDir that doesn't require the 4th parameter, which is a maximum size for the mounted directory, but that function has been removed, so you have to call the 4-argument version. Despite the name, mountFixedDir will mount a single file, not just a directory.
It might be marginally easier to just extract directly to ComputerCraft/lua/rom, but personally I prefer having the files appear only on the computers that mount the peripheral rather than on all computers. If you are adding an API which needs to be loaded, you might want to go ahead and put it in rom for all computers, otherwise you would have to reboot the computer for the API to load after attaching the peripheral.