Any way to get the Monkey/Trans folder?

Monkey Forums/Monkey Programming/Any way to get the Monkey/Trans folder?

Nobuyuki(Posted 2015) [#1]
Just curious if there's an easy way to get the string for the folder that the compiler's running from, or (ideally) the folder of the Monkey installation which trans is running in. I'm making a tool which needs some files from there, and it would be convenient to not have to specify this location if the compiler can pass it to the code somehow.

I'm aware that ${CD} does return the current source file's location, but what I'm looking for is a location relative to trans. Does this exist anywhere that's easy to get to?


ImmutableOctet(SKNG)(Posted 2015) [#2]
The best thing I can think of is Ted's configuration file, which is generated when you first start it. Found in "bin/ted_HOSTHERE_COMPUTERNAMEHERE.ini/Blitz Research Ltd". The thing is, you'd need to know where Monkey is anyway. From the preprocessor, I don't think there's a way to do it, though. Unless you're using native code, the preprocessor wouldn't be useful for this anyway.

I'm confused, why can't your tool just let you specify the directory. Assuming it's made in Monkey, and you really want to make it nice, you could even use 'brl.requesters' to request the directory. From there, just use 'SaveState', a 'FileStream', or even 'SaveString'. Then you can just reload the next time you use it.

Not the most convenient, but considering your idea seems to be hard-coding the path using the preprocessor, this seems a lot easier.


Nobuyuki(Posted 2015) [#3]
I can specify the directory, though it seems silly for a tool which is supposed to help automate the build chain for a specific library. I was hoping for a "pure monkey" solution, where you can just compile and it simply modifies its code based on what it finds in the Monkey folder. Anyway, since the builder doesn't need to be run on every compile, (only when Monkey's updated with changes to the files I need to get to), I have the location hard-coded in a Const anyway. I'll let people screw around with that themselves manually, although in the future, it would be cool to have a "set it and forget it" version.