Closed sohocoke closed 6 years ago
Hmm. You can influence it in the sense that it's dynamic (an attribute of every Ruby program, which changes as the program executes), so, e.g. Dir.chdir __dir__
(or Dir.chdir '..', __FILE__
on older rubies) would change it to the dir of the file, like Sublime.
Did a quick scan, and it doesn't look like I ever put any code into either editor to deal with CWD, so they probably have different defaults regarding that. There's no flag on SiB to deal with such things, though I've considered it once or twice. So really, the answer is probably to not rely on CWD (prob why I never run into such issues), so either use absolute filepaths (generally advocated, as this is a ubiquitous solution, beyond SiB), or change directories at the top of your script. If you do this frequently, you can prob add a snippet/keyboard command that adds the code for you, to ease the annoyance.
Hi, @sohocoke I've added a flag that sets the default CWD to the dir of the file that is being evaluated. That option is now set as part of the default configuration Atom, so if you download the latest version, and update your SiB to 3.4.0, then this behaviour should be what you expected.
Unlike in the Sublime plugin,
pwd
evaluates to/
, rather than the file's enclosing dir.Is the working directory something I can configure / influence?