Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Location of the exe in Eclipse Luna (C++)(It's in E:/cpp/myproject/bin/Release...not E:/cpp/myproject !!)
Location of the exe in Eclipse Luna (C++) [message #1701404] Mon, 13 July 2015 09:00 Go to next message
Sequoia Tree is currently offline Sequoia TreeFriend
Messages: 28
Registered: August 2014
Junior Member
Working with Luna Release (4.4.0) in C++ and using Qt 5.4 widgets.

I need to have this code tell me the truth.

myproject.exe is located in : E:/cpp/myproject/bin/Release

not in E:/cpp/myproject as Qt QDir objects want to tell me.

I've used :

QString currentPath = QDir::currentPath(); 


and it ignores "bin/Release"

I've also used :

QDir dir;
QString s1 = dir.absolutePath();


and this also ignores "bin/Release"

If I copy the myproject.exe file to X:/a/b/c directory

then these two methods tell the truth that the exe is located in

X:/a/b/c

Why is the development environment so sneaky in this regard?
Re: Location of the exe in Eclipse Luna (C++) [message #1701534 is a reply to message #1701404] Tue, 14 July 2015 01:38 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 07/13/2015 03:00 AM, Sequoia Tree wrote:
> Working with Luna Release (4.4.0) in C++ and using Qt 5.4 widgets.
>
> I need to have this code tell me the truth.
>
> myproject.exe is located in : E:/cpp/myproject/bin/Release
>
> not in E:/cpp/myproject as Qt QDir objects want to tell me.
>
> I've used :
> QString currentPath = QDir::currentPath();
> and it ignores "bin/Release"
>
> I've also used :
>
> QDir dir;
> QString s1 = dir.absolutePath();
>
> and this also ignores "bin/Release"
>
> If I copy the myproject.exe file to X:/a/b/c directory
>
> then these two methods tell the truth that the exe is located in
>
> X:/a/b/c
>
> Why is the development environment so sneaky in this regard?

You'll find more and better help with C/C++ and Eclipse in the Eclipse
CDT forum.
Re: Location of the exe in Eclipse Luna (C++) [message #1701535 is a reply to message #1701404] Tue, 14 July 2015 01:39 Go to previous messageGo to next message
David Wegener is currently offline David WegenerFriend
Messages: 1445
Registered: July 2009
Senior Member
You are confusing the current directory with the absolute path to the
executable. These are two different things. The current directory is
the directory where the executable is started. This has nothing to do
with the path to the executable. Eclipse launches executables in the
project directory. This is consistent with what you included in your post.
Re: Location of the exe in Eclipse Luna (C++) [message #1701538 is a reply to message #1701535] Tue, 14 July 2015 04:08 Go to previous messageGo to next message
Sequoia Tree is currently offline Sequoia TreeFriend
Messages: 28
Registered: August 2014
Junior Member
David Wegener wrote on Tue, 14 July 2015 01:39
The current directory is the directory where the executable is started. This has nothing to do with the path to the executable. Eclipse launches executables in the project directory.


...where the exe is started .... has nothing to do with the path to the exe.
Sounds like something a politician would say. Laughing

Does the development environment pick up the SF030.exe and move it to another place before actually executing it??

What are the magic words to intone when I want to have the answer :
"E:/cpp/SF030/bin/Release"
Re: Location of the exe in Eclipse Luna (C++) [message #1701658 is a reply to message #1701538] Tue, 14 July 2015 17:54 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
It's more of a C++ question. I don't know what their launch
configurations support, but most support settings the working/current
directory for the launched process. So you might use something like
${resource_loc:/SF030/bin/Release} for that value.

On 14/07/2015 6:08 AM, Sequoia Tree wrote:
> David Wegener wrote on Tue, 14 July 2015 01:39
>> The current directory is the directory where the executable is
>> started. This has nothing to do with the path to the executable.
>> Eclipse launches executables in the project directory.
>
>
> ..where the exe is started .... has nothing to do with the path to the
> exe.
> Sounds like something a politician would say. :lol:
> Does the development environment pick up the SF030.exe and move it to
> another place before actually executing it??
>
> What are the magic words to intone when I want to have the answer :
> "E:/cpp/SF030/bin/Release"
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Location of the exe in Eclipse Luna (C++) [message #1701662 is a reply to message #1701658] Tue, 14 July 2015 18:30 Go to previous messageGo to next message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3070
Registered: July 2009
Senior Member
Imagine I have an application executable, someApp.exe installed in C:\Program Files
I can go to C:\temp and execute it using the command line C:\Program Files\someApp.exe
What is the "current working directory" in that scenario?
It's C:\temp (nothing to do with the path to the executable).

That's the situation you're in, only the "current" directory is your Eclipse project root (as Ed and David explained) and the path to the executable is under your project's bin/ folder. Make sense?
Re: Location of the exe in Eclipse Luna (C++) [message #1701799 is a reply to message #1701662] Wed, 15 July 2015 17:59 Go to previous messageGo to next message
Sequoia Tree is currently offline Sequoia TreeFriend
Messages: 28
Registered: August 2014
Junior Member
Eric Rizzo wrote on Tue, 14 July 2015 18:30
under your project's bin/ folder. Make sense?


yes, that makes sense.

What doesn't make sense is that there is no way in the Eclipse working environment to say in the form of an answer :

"your exe is located in E:/cpp/myproject/bin/Release"

that is where the exe is located.

How do I get that info?

Re: Location of the exe in Eclipse Luna (C++) [message #1701807 is a reply to message #1701799] Wed, 15 July 2015 20:12 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
It depends on where you are asking. If it's in the running environment,
it's a C++ runtime question best asked on the CDT forum. If it's in the
launcher, I've already told you about using variables.

On 15/07/2015 7:59 PM, Sequoia Tree wrote:
> Eric Rizzo wrote on Tue, 14 July 2015 18:30
>> under your project's bin/ folder. Make sense?
>
>
> yes, that makes sense.
>
> What doesn't make sense is that there is no way in the Eclipse working
> environment to say in the form of an answer :
>
> "your exe is located in E:/cpp/myproject/bin/Release"
>
> that is where the exe is located.
>
> How do I get that info?
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Search and Replace a pattern in eclipse.
Next Topic:Starting Jetty server 9.3 from command line to server static content
Goto Forum:
  


Current Time: Fri Mar 29 06:30:41 GMT 2024

Powered by FUDForum. Page generated in 0.03844 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top