eclipse-corrosion / corrosion

Eclipse Corrosion - Rust edition in Eclipse IDE
Eclipse Public License 2.0
224 stars 31 forks source link

Setting startup directory in launch configuration #99

Closed norru closed 6 years ago

norru commented 6 years ago

I haven't found the settings to change the startup directory. It doesn't seem to be starting from the root directory of the project by default, am I wrong?

Here's what I'm looking for.

https://stackoverflow.com/questions/21028690/how-do-i-change-the-working-directory-for-an-eclipse-run-configuration

LucasBullen commented 6 years ago

To confirm, you are looking to set the location that your program will be run correct? Like if your code was:

fn main() -> std::io::Result<()> {
    let mut file = File::create("foo.txt")?;
    file.write_all(b"Hello, world!")?;
    Ok(())
}

You wish to set the location that the foo.txt file would be created instead of the eclipse directory?

norru commented 6 years ago

Kinda; I refer to files I'm loading in using relative paths (from cwd), which is hardly uncommon. All other languages I use Eclipse for have that option and assume the default to be the root of the project.

LucasBullen commented 6 years ago

Ok, both scenarios would be solved with the same solution of setting the working directory of DebugPlugin.exec(); in the LaunchConfigurationDelegates. I agree this should be implemented and added to my to do list unless you or someone wishes to beat me to it.

norru commented 6 years ago

It would be a very welcome addition. At the moment I am short on time to help, sorry!

Anyway, it's coming up nicely, keep up the good work!

I'd love to switch to redOx as soon as it's even barely usable :). I used to love RustDT before it was abandoned, at the moment I'm on CLion + IntelliJ but I can't get used to their workflow. The sooner I can get back to the Eclpise fold, the better!

In fact I am now at a point where I can start giving it a go for my (weekend) day-to-day project. My intention is to report any requests/bugs/findings.

On 24 July 2018 at 20:54, Lucas Bullen notifications@github.com wrote:

Ok, both scenarios would be solved with the same solution of setting the working directory of DebugPlugin.exec(); in the LaunchConfigurationDelegates. I agree this should be implemented and added to my to do list unless you or someone wishes to beat me to it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/eclipse/corrosion/issues/99#issuecomment-407531119, or mute the thread https://github.com/notifications/unsubscribe-auth/AA2Ry3s-tu9BA2qcGmeVqoyas4zqSV5bks5uJ3tcgaJpZM4VdTfy .

-- Cheers, Nico

LucasBullen commented 6 years ago

The more requests/bugs/findings the better!

norru commented 6 years ago

Right, so...

I've found a workaround for the cwd problem which also fixes a few other things.

It does appear that for lack of other options, all executables started from redOx inherit the cwd of their parent, namely the IDE itself. This includes rls and cargo

In short starting the Eclipse IDE from my project root:

cd ~/path/to/my/rust-project
/opt/eclipse-dist/eclipse-rust/eclipse&

Eclipse redOx, here I come (again)!

PS: this workaround only works because I've got only one Rust exe project in my workspace.

LucasBullen commented 6 years ago

Implemented with f6869b9