[Tips] Reusable Library Directories

Home Forums Monkey 2 Code Library [Tips] Reusable Library Directories

This topic contains 8 replies, has 3 voices, and was last updated by  cocon 1 week, 3 days ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #9132

    cocon
    Participant

    If you want to avoid duplicating your libraries over and over again across various projects you can follow this approach.

     

    Making directory links in Linux should be like this:

    #9135

    AdamStrange
    Participant

    why not just use something like:

    where ../ goes to the folder above the current folder?

    #9143

    cocon
    Participant

    Yeah this is another good approach, I have seen that various open source projects are based on this approach, such as Blender. I would choose this one if the project was very streamlined and active, it would worth an appropriate file system setup.

    In my hard disk, everything is very unorganized – among various drives and cloud data. Also since I started organizing the projects based on date the file system relations become even more distributed.

    I would hope that Monkey2 perhaps in the future might support include and lib parameters, so things become a little flexible there.

    #9148

    AdamStrange
    Participant

    then it would be something like this:

    <span class=”crayon-o”>#</span><span class=”crayon-r”>import</span> <span class=”crayon-s”>”../../MonkeyLibraries/rameses3d/rameses3d”</span>

    lets say you are in project2

    ../ takes you to MonkeyProjects

    ../../ takes you to the core folder (lets say monkey2)

    ../../MonkeyLibraries takes you to the monkey libraries

    from there you can go to your libraries project

    #9159

    cocon
    Participant

    In this example the libraries and projects are placed in the same directory. But in a real case of where this approach would be useful is this. 🙂

    #9527

    scurty
    Participant

    You could use environment variables too, couldn’t you?

    #9570

    cocon
    Participant

    Where?

    #9752

    scurty
    Participant

    Sorry for the late reply.
    In Windows (Not sure about other OS’s ATM) you can add an “Environment Variable.”
    Essentially they’re “Global” variables used when executing commands via “system(‘echo %PATH%’);” in the standard sense.
    So in a sense, you could add a directory path to your %PATH% system variable containing your modules, and if it’s implemented in MX2CC it should compile just fine. This is how your system knows where DLL’s/Modules are installed or for any required purpose.

    I haven’t tested if this works yet or not, but it should to keep source management a bit less “copy & pasty”
    and it’s only a few clicks in the Control Panel. So you don’t have to dig too deep and possibly mess something up.
    However, good job one finding another way with added benefits! I honestly didn’t know you could achieve this like you did. 5/5

    #9764

    cocon
    Participant

    From what I see, I can open a file from command prompt nicely, but the monkey2 compiler can’t figure out the location of the file. I wonder if it’s related to the reason that monkey can’t load full-paths as well. 🙂

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.