File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -1603,11 +1603,16 @@ FUNCTIONS
1603
1603
ProgramGid(int)
1604
1604
Same as the -G flag if called from .init.lua for setgid()
1605
1605
1606
- ProgramDirectory(str)
1606
+ ProgramDirectory([directory: str]) → {directory, ...}
1607
1607
Same as the -D flag if called from .init.lua for overlaying local
1608
1608
file system directories. This may be called multiple times. The
1609
1609
first directory programmed is preferred. These currently do not
1610
1610
show up in the index page listing.
1611
+ This call also modifies `package.path` value to either prepend
1612
+ the added directory in front of the default path (if found) or
1613
+ to append it (in all other cases).
1614
+ If no directory is provided, then a table with previously set
1615
+ directories is returned.
1611
1616
1612
1617
ProgramLogMessages(bool)
1613
1618
Same as the -m flag if called from .init.lua for logging message
Original file line number Diff line number Diff line change @@ -4580,6 +4580,18 @@ static int LuaProgramBrand(lua_State *L) {
4580
4580
}
4581
4581
4582
4582
static int LuaProgramDirectory (lua_State * L ) {
4583
+ size_t i ;
4584
+ // if no parameter is provided, then return current directories
4585
+ if (lua_isnoneornil (L , 1 )) {
4586
+ lua_newtable (L );
4587
+ if (stagedirs .n ) {
4588
+ for (i = 0 ; i < stagedirs .n ; ++ i ) {
4589
+ lua_pushlstring (L , stagedirs .p [i ].s , stagedirs .p [i ].n );
4590
+ lua_seti (L , -2 , i + 1 );
4591
+ }
4592
+ }
4593
+ return 1 ;
4594
+ }
4583
4595
struct stat st ;
4584
4596
const char * path = luaL_checkstring (L , 1 );
4585
4597
// check to raise a Lua error, to allow it to be handled
You can’t perform that action at this time.
0 commit comments