Re: Phix - Cannot open autoinclude VM/pLen.e

new topic     » goto parent     » topic index » view thread      » older message » newer message

I think I've found the main culprit - command_line() on Linux was not yielding full paths like it does on Windows.

I've pushed a new builtins/VM/pcmdlnN.e; line 316, after

 
        for i=1 to N do 
            res = append(res,peek_string(peekNS(pArg4*4+i*W+W,W,0))) 
        end for 

insert

 
        string r1 = res[1] 
        if get_file_type(r1)!=FILETYPE_FILE then 
            sequence s = split(getenv("PATH"),':') 
            for i=1 to length(s) do 
                string sir = join_path({s[i],r1}) 
                if get_file_type(sir)=FILETYPE_FILE then 
                    res[1] = sir 
                    exit 
                end if  
            end for 
        end if 
        if length(res)>=2 then 
            string r2 = res[2] 
            if get_file_type(r2)!=FILETYPE_FILE then 
                string cdr = join_path({current_dir(),r2}) 
                if get_file_type(cdr)=FILETYPE_FILE then 
                    res[2] = cdr 
                end if 
            end if 
        end if 
ghaberek said...

I'm curious, why are you using (or even supporting) EUDIR in the first place?

It probably made a bit more sense back in the 2.4..3.1 days, and should probably be ripped out now (especially since we just proved it useless).

ghaberek said...

Coming in off the street, I would expect any modern language to find its include files in this order:

  1. One or more paths specified on the command line (e.g. -I <path>)
  2. One or more paths specified by config file (e.g. eu.cfg)
  3. The current directory from where the command is run
  4. The original directory where the executable resides

That all looks good, but....
That change above is probably equivalent to the fourth one, and I'm pretty sure the third is already covered.
While -I might be a handy programmer shortcut, it has implications for code sharing and customer installations - if you don't know what to put after the -I you'll never get the code to run, ditto eu.cfg.
The executable 'p' and the directory 'builtins' really ought to be in the same place (and it was just a stupid bug that the compiler didn't know how to figure that one out), and "stub includes" just feel better to me, for instance builtins\pGUI.e is just "include ../demo/pGUI/pGUI.e", which is obviously per-machine, and per-project is very similar - all virtually equivalent to eu.cfg files anyway.
I won't dig me heels in against doin it your way, but I'm not keen.

Pete

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu