1. Why is current_dir() Not the Directory my Program is Run From?

I'm right-clicking my ".exw" file in Windows and choosing, "Run with Euphoria for Windows interpreter."

When I do that, current_dir() returns "c:\windows\system32," which isn't where euiw or my source is located.

I'm running into a problem with read_lines( "myfile.txt" ) because it's apparently looking in current_dir(), and "myfile.txt" isn't there.

I don't want to have to chdir(). I expect it to just find it in the source-containing folder.

What should I do here?

FOLLOW-UP: The translated file does NOT exhibit this behavior. Apparently, its current_dir() is the directory in which the executable is run.

new topic     » topic index » view message » categorize

2. Re: Why is current_dir() Not the Directory my Program is Run From?

Do you get the same from init_curdir()?

new topic     » goto parent     » topic index » view message » categorize

3. Re: Why is current_dir() Not the Directory my Program is Run From?

petelomax said...

Do you get the same from init_curdir()?

Yes. Although, the init_curdir() path has a trailing backslash. current_dir() does not. getlost

new topic     » goto parent     » topic index » view message » categorize

4. Re: Why is current_dir() Not the Directory my Program is Run From?

Hi,
why not just change the attributes in the shortcut, so that the path is where u want?
Thats what I do, I have a few shortcuts with path pointing to different projects, and they also have thier own eu.cfg.
No problems on Win7, Win81.

new topic     » goto parent     » topic index » view message » categorize

5. Re: Why is current_dir() Not the Directory my Program is Run From?

Use this instead of current_dir().

include std/filesys.e 
 
public function startup_dir() 
    sequence cmd = command_line() 
    return pathname( cmd[2] ) 
end function 

-Greg

new topic     » goto parent     » topic index » view message » categorize

6. Re: Why is current_dir() Not the Directory my Program is Run From?

ghaberek said...

Use this instead of current_dir().

include std/filesys.e 
 
public function startup_dir() 
    sequence cmd = command_line() 
    return pathname( cmd[2] ) 
end function 

-Greg

That works, Greg! But you knew it would. grin

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu