myFunnyGame.data

Monkey Forums/Monkey Programming/myFunnyGame.data

bruZard(Posted 2011) [#1]
can anyone explain how monkey explores the project name to find out where the assets lies? I've explored the other targets but i can't find out where this magic is happened.

say we have a project named "myFunnyGame.monkey", how can i find out that the project has this name to build the assets path to "myFunnyGame.data"?

It's for the AmigaTarget of course ...


DruggedBunny(Posted 2011) [#2]
This seems to work, though you'll have to code Amiga versions of ChangeDir and CurrentDir -- you can probably just copy them from Monkey\modules\os\native\os.cpp.

Import os ' STDCPP and GLFW only!

Function Main ()
	Local current:String = CurrentDir ()
	ChangeDir ("..") ' Parent dir...
	Print "PROJECT: " + StripAll (CurrentDir ()) ' Shows project name...
	ChangeDir current ' IMPORTANT!
End



therevills(Posted 2011) [#3]
I "hacked" Trans so I dont have to use "project.data" and just use "data":

http://www.monkeycoder.co.nz/Community/posts.php?topic=1020#8812

Does anyone (Mark!) know why Trans was coded this way in the first place?


DruggedBunny(Posted 2011) [#4]

Does anyone (Mark!) know why Trans was coded this way in the first place?



One guess would be that it allows multiple projects in one main source folder, eg.

monkeysrc/
monkeysrc/game1.monkey [uses monkeysrc/game1.data]
monkeysrc/game2.monkey [uses monkeysrc/game2.data]


Of course, most of us probably create sub-folders for all projects, but there's no accounting for taste. (I'd also have preferred a single 'data' folder so multiple main source files can use the same data.)


Samah(Posted 2011) [#5]
One guess would be that it allows multiple projects in one main source folder, eg.

Since I'm constantly working/modifying Diddy, I don't install it as a module. This means I have to have any executable monkey source (such as the Diddy examples) in the parent directory to the Diddy source, which means I need different data directories for each one.

src/
  testParticle.monkey
  testParticle.build/
  testParticle.data/
    <assets>
  testGUI.monkey
  testGUI.build/
  testGUI.data/
    <assets>
  diddy/
    framework.monkey
    ...



Tibit(Posted 2011) [#6]
Does anyone (Mark!) know why Trans was coded this way in the first place?
That is a very good question.

However it seems it would be VERY handy if I could have several examples (with graphics) sharing the same data folder. Now I create a folder-copy per example/game I make, but it does result in a lot of unnecessary copying of images and sounds - which makes me avoid graphics in examples or mock-ups.

I'd vote for therevills data hack to be implemented for real, is there any real downside?