Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scope debug plugin: using resources with relative path #785

Closed
perezh opened this issue Oct 26, 2018 · 7 comments
Closed

Scope debug plugin: using resources with relative path #785

perezh opened this issue Oct 26, 2018 · 7 comments

Comments

@perezh
Copy link

perezh commented Oct 26, 2018

Hi all,
I've successfully built the current master of geany and geany-plugins from source with the scope plugin. However, it seems that binaries are executed in a different way from geany when debugging.

I've a program which opens a image file using a relative path (e.g., ./resources/file.png). When geany is used to execute it, it runs without any problem. When I run it using scope, the program raises an error stating that the file cannot be found.

If I use an absolute path to the file, then I can run the program without errors from geany and from the debugger.

Thanks very much!

@lpaulsen93
Copy link
Contributor

Hi perezh,
did you set the "Working dir" under "Setup"?

@perezh
Copy link
Author

perezh commented Oct 26, 2018

No, I didn't. It was empty.
Anyway, I added the folder with the binary now and the error is still there.
Thanks

@lpaulsen93
Copy link
Contributor

This seems to work OK for me. I created a file in a folder program/test/test.txt and I could open it in a test program (via fopen ("./test/test.txt", "r");. My working dir was set to the program folder. Are you sure you set the directory properly?

E.g. see the screenshot below:

scope_set_workingdir_edited

Only setting the Executable is not enough.

@perezh
Copy link
Author

perezh commented Feb 27, 2019

Thanks for your reply. This is how the scope debugger works, but it is somehow unusual to set a working dir since running the binary in geany without debugging does not require it. At least, this does not seem the typical setup in other debuggers. Anyway, I think we can close this issue as it is the expected behaviour of the scope plugin.
Kind regards!

@perezh perezh closed this as completed Feb 27, 2019
@lpaulsen93
Copy link
Contributor

since running the binary in geany without debugging does not require it

Of course not. But if the program uses a relative path then you need the correct working dir to be set.

Well, an alternative would be to use the directory of the binary, if the "Working dir" is empty. But I think using the directory of the binary might not always be the correct working dir so I do not want to remove that option. Another option would be to use the current project's base path (if a project is open).

@perezh
Copy link
Author

perezh commented Feb 27, 2019

Yes, I fully agree. If working dir is empty, the default dir should be the directory of the binary. This can speed up working with geany.

@elextr
Copy link
Member

elextr commented Feb 28, 2019

since running the binary in geany without debugging does not require it.

Actually it does, see Build->Set Build Commands its just that it defaults to the directory of the open document if nothing is specified. Which is not always sensible.

So using the directory of the specified executable as default when nothing is specified makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants