Monkey
Store
Community
Apps
Contact
Login or Signup

Modules directory

Monkey Programming Forums/Monkey Programming/Modules directory

Samah(Posted 1+ years ago) #1
Monkey has been around for over a year now, and we still can't customise the location of modules.

I have Diddy in its own repository location (not in monkey/modules) and it's annoying to have to copy it over every time I make a change. I end up working in the Diddy directory so I don't have to.

Either have it as a config value in the trans ini file, or a precompiler directive in your source.

Edit: config.txt version here:
http://puu.sh/Hw5H (trans.monkey)
http://puu.sh/HwgG (trans_winnt.zip)


Skn3(Posted 1+ years ago) #2
Definitely a +1 for this!

Another helpful option would be able to have multiple module locations! That way the official and user modules can be kept separate!


c.k.(Posted 1+ years ago) #3
Definitely should be supported already.

Yes, keep the modules folder for the standard libs. But give us a way to specify another location.


Jesse(Posted 1+ years ago) #4
+1. and agree with Skn3, Definitely a must.


Neuro(Posted 1+ years ago) #5
Agree on this.


ReddoC(Posted 1+ years ago) #6
me too :)


Qcat(Posted 1+ years ago) #7
+1 me too


Samah(Posted 11 months ago) #8
Hmm... it appears there is a -modpath command line option in Trans that does this, but you need to supply the entire module path, which is generated with this:
ENV_MODPATH=".;"+ExtractDir( srcpath )+";"+RealPath( ExtractDir( AppPath )+"/../modules" )

Not exactly an easy thing to append to on the command line. Rather than break existing functionality, I've added a -modpathappend option which adds extra directories to the module path (semicolon separated). I haven't looked at Ted yet, but from what I can see, neither Monk nor Jungle have a place to add command line parameters to trans. At the moment, the only solution is to compile by command line.

F:\Monkey\monkey\bin>trans_winnt.exe -target=html5 test.monkey
TRANS monkey compiler V1.34
Parsing...
F:/Dev/Repositories/Monkey/monkey/bin/test.monkey<1> : Error : Module 'diddy' not found.

F:\Monkey\monkey\bin>trans_winnt.exe -target=html5 -modpathappend="F:\Dev\Repositories\Diddy\src" test.monkey
TRANS monkey compiler V1.34
Parsing...
Semanting...
Translating...
Building...


trans.monkey:
http://puu.sh/GIs1

Sorry, you'll have to build it yourselves. I only have MinGW set up so it complains if the DLL files aren't also in the bin directory.


therevills(Posted 11 months ago) #9
Cool!

Just another idea, could we use the "config.(os).txt" by adding a mod path in there?


Samah(Posted 11 months ago) #10
Actually I was about to add (but I ducked off to the shower), that it should really be in the config.txt. Alternatively, you can provide the entire environment path to -modpath, but you need to provide the full path to the modules directory and it's specific for each source file.

-modpath=".;test;F:\Monkey\modules"



wiebow(Posted 11 months ago) #11
If you use Windows 7 or vista you can do as I do: Use mklink.exe to create a directory (sym)link to your development module folder.

example:
My module work folders are located in d:\development\monkey\wdw

I use this command in the module dir of monkey: mklink /D wdw d:\development\monkey\wdw

this will let monkey see a wdw folder in its monkey folder which points to my d:\development\monkey\wdw folder.


Samah(Posted 11 months ago) #12
I've updated trans.monkey to support a MODULE_PATH variable in config.txt. See the first post for a link to the modified source.

Essentially, put this in your config.txt and compile as per normal.

MODULE_PATH="D:\Some\Other\Module\Path"


It will append it to the default module path.


therevills(Posted 11 months ago) #13
Very nice... only 4 lines of (new) code... Mark can please add this officially??


therevills(Posted 11 months ago) #14
Bump for the next version of Monkey please :)


therevills(Posted 10 months ago) #15
This has been added to Monkey-ext:

http://www.monkeycoder.co.nz/Community/posts.php?topic=3387