1 Reply Latest reply on Apr 18, 2012 12:52 PM by areohbee

    _PLUGIN:resourceId() for resources not in the plug-in root directory?

    Don McKee

      For ages, I've been using

       

      f:picture {

      value = _PLUGIN:resourceId( "images/myImage.png" )

      }

       

      to successfully load resources on Windows.  Today, I just discovered that the same code doesn't work on my wife's Mac laptop.  If I move the resource to the plug-in's root directory, then

       

      f:picture {

      value = _PLUGIN:resourceId( "myImage.png" )

      }

       

      works as expected.

       

      Is this the way _PLUGIN:resourceId() (and _PLUGIN:hasResource()) is supposed to work??  If it is, or as a work-around, if I don't want to clutter up my root directory, is there any reason why I shouldn't use

       

      f:picture {

      value = _PLUGIN.path .. "/images/myImage.png"

      }

       

      instead?


      -Don

        • 1. Re: _PLUGIN:resourceId() for resources not in the plug-in root directory?
          areohbee Level 5

          I noticed the same is true of other relative file references too, not just resources (e.g. specification of modules in Info.lua). Mac is different than Windows in this regard (Windows takes subpaths, Mac doesn't).

           

          No reason not to use absolute paths that I can see.

           

          Also, if I remember correctly:

           

          value = _PLUGIN:resourceId( _PLUGIN.path .. "/images/myImage.png" ) -- works, although I'm not sure what it buys you...

           

          Rob

          1 person found this helpful