Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 19, 2008, 8:39:40 PM (16 years ago)
Author:
rgrieder
Message:

Added 'w' argument for tolua. That specifies the working directory when including files in the package.
If 'w' is not specified, the path of the package file is used. And if even that is not given, the application working directory is used.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/buildsystem/src/tolua/lua/package.lua

    r2229 r2233  
    277277    end
    278278
     279    -- prepare working directory
     280    local current_path
     281    if not flags.w and flags.f then
     282        current_path = gsub(flags.f, '(/)[^/]*%.?[^/]*$', '%1')
     283    elseif flags.w then
     284        if not (string.sub(flags.w, string.len(flags.w)) == '/') then
     285            current_path = flags.w..'/'
     286        else
     287            current_path = flags.w
     288        end
     289    else
     290        current_path = ''
     291    end
     292
    279293    -- deal with include directive
    280294    local nsubst
     
    283297            function (kind,fn,extra)
    284298                local _, _, ext = strfind(fn,".*%.(.*)$")
    285                 local fp,msg = openfile(fn,'r')
     299                local fp,msg = openfile(current_path..fn,'r')
    286300                if not fp then
    287301                    error('#'..msg..': '..fn)
Note: See TracChangeset for help on using the changeset viewer.