Closed GoogleCodeExporter closed 9 years ago
Global directory was the original design, and is still supported: factory.c
sets the environment variable LUA_PATH to <program's data
directory>/scripts/libs/?.lua
so any script anywhere that does 'require("memory")' will call
scripts/libs/memory.lua
But this strategy doesn't work with user-provided libraries, whose version can
change over time : so DawnBringer's scripts should always refer to the specific
dawnbringer_lib.lua they're shipped with.
Generally, Lua seems to have a very bad support for subdirectories, we also
have the problem that dofile() is relative to the directory of the first
calling script, not the called one. I think we should implement a specific
run() that:
1) changes the current directory
2) runs the called script
3) changes back the current directory
As a step 1b, it could also perform any string modification so that a script
written for a Linux/Windows filesystem can be translated to AROS filesystem
terms.
As I understand from the link below, "../../libs/memory.lua" for example would
be translated to "//libs/memory.lua"
http://aros.sourceforge.net/documentation/users/shell/introduction.php#id1
Original comment by yrizoud
on 11 Aug 2012 at 5:42
> As I understand from the link below, "../../libs/memory.lua" for example
> would be translated to "//libs/memory.lua"
Yes, that's right.
Original comment by mazzearos
on 12 Aug 2012 at 8:26
Path conversion is implemented in r1991.
The recommendation for writers of Lua scripts is to use / path separators, and
../ for previous directory. And be careful of case sensitivity. And use
relative paths, not system-specific ones like "DF0:foo" or "C:\foo" or
"/local/users/foo"
This way, the same scripts will work equally well on all platforms.
Please test and let me know how it goes.
Original comment by yrizoud
on 15 Aug 2012 at 5:22
From looking how PARENT_DIR is defined in const.h, it seems the specific
conversion should by applied in cases __MORPHOS__ __amigaos4__ __amigaos__ too.
Original comment by yrizoud
on 15 Aug 2012 at 5:59
> Please test and let me know how it goes.
Very good. Thanks :-)
> From looking how PARENT_DIR is defined in const.h, it seems the
> specific conversion should by applied in cases __MORPHOS__
> __amigaos4__ __amigaos__ too.
That's probably true for a lot of my recent fixes for AROS. I'd prefer is
someone who can test does the changes.
Original comment by mazzearos
on 16 Aug 2012 at 9:38
Original comment by yrizoud
on 23 Sep 2012 at 11:55
Original issue reported on code.google.com by
mazzearos
on 6 Aug 2012 at 12:23