1. Why is current_dir() Not the Directory my Program is Run From?
- Posted by euphoric (admin) Dec 30, 2016
- 1548 views
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.
2. Re: Why is current_dir() Not the Directory my Program is Run From?
- Posted by petelomax Dec 30, 2016
- 1499 views
Do you get the same from init_curdir()?
3. Re: Why is current_dir() Not the Directory my Program is Run From?
- Posted by euphoric (admin) Jan 03, 2017
- 1448 views
Do you get the same from init_curdir()?
Yes. Although, the init_curdir() path has a trailing backslash. current_dir() does not.
4. Re: Why is current_dir() Not the Directory my Program is Run From?
- Posted by fizzpopsoft Jan 04, 2017
- 1415 views
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.
5. Re: Why is current_dir() Not the Directory my Program is Run From?
- Posted by ghaberek (admin) Jan 04, 2017
- 1352 views
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
6. Re: Why is current_dir() Not the Directory my Program is Run From?
- Posted by euphoric (admin) Jan 04, 2017
- 1326 views
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.