Re: Include File Relative Paths

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

c.k.lester wrote:
> What needs to change for this to work:
> 
> -- c:\htdocs\my_prog.e
>   include mydir/inc1.e
> 
> -- c:\htdocs\mydir/inc1.e
>   if sequence(dir("res/myfile.txt")) then
>      fn = open("res/myfile.txt","r")
>   else
>      puts(1,"Doesn't work.")
>   end if
> 
> -- c:\htdocs\mydir\res\myfile.txt
>   setting1=c:\
>   setting2=Craig
>   setting3=Robert
> 
> Something needs to change so that open() and dir() both understand that
> if it doesn't find "res/myfile.txt" in some default location, it is to
> look for it starting with the calling file's directory.
> 
> Relative file locations = good
> 
> If this is not going to be changed, I can work around it. I just haven't
> seen a downside to this, yet. Anybody want to suggest some?

I was thinking about this and I think it's a bad idea for open(). It's a good
idea for include though.

When you include a file, then as far as that file is concerned it is part of the
main app and runs from the same directory.

What am I missing?

--
"Any programming problem can be solved by adding a level of indirection."
--anonymous
"Any performance problem can be solved by removing a level of indirection."
--M. Haertel
"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare
j.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu