Registered Member
|
A lot of times I want to run a small test program that I don't want to make a project for. I just want to click an icon and run the current file with it set to use that files location as the working directory/include path. Is there a way to do something like that?
|
Global Moderator
|
Create a shellscript with these contents:
and configure that as a new (gloabl) run configuration called "run current document" or so. That should work. Note that you'll need to adjust the script if you run more than one instance of kdevelop. Greetings, Sven
I'm working on the KDevelop IDE.
|
Registered Member
|
It almost works. Path '5598' is not a valid path name. From the command line if I do echo $(pidof kdevelop) it lists 3 numbers, 5601 5598 4867 (the middle one is in the error message). If I replace $(pidof kdevelop) with one of the other numbers then echo $(qdbus org.kdevelop.kdevelop-4867 /org/kdevelop/DocumentController activeDocumentPath) works and will display the pathname of the current file in kdevelop. Any way to narrow $(pidof kdevelop) to the right pid? |
Global Moderator
|
Yes as said, that will run into problems if you have multiple kdevelop sessions.
I didn't test it, but try this instead of "pidof kdevelop":
That should get the PID of the parent process of the script, which should be the kdevelop instance which launched the script.
I'm working on the KDevelop IDE.
|
Registered Member
|
Thanks. All along your help has been vital in me getting kdevelop built, setup and working for python. The first qdbus script is working now. Apparently I had other instances of kdevelop running that I didn't know about. I haven't quite figured out sessions yet. It seems that the run launches are tied to them. I seem to have to recreate this run launch every time. Is there a way to make it stay for all sessions? |
Global Moderator
|
A session is just a group of projects with some settings. You're meant to group all projects which belong together in some way into a session. You can then just open the session instead of all the individual projects. It's that simple -- a session is just a set of open projects.
A useful thing to do is running kdevelop with the "-ps" option, as in "kdevelop -ps". That'll start the session picker first, where you can select what you want to work on. Technically a session is tied to an instance of the persistent cache KDevelop uses for language analysis. This means that you can only have one KDevelop instance with a specific session opened, and if you have the same project open in multiple sessions, it will be parsed twice. Just FYI. And yes, "global" launch configurations are per-session, so you'll need to add that script for each session. But, how many sessions do you have? Usually you have like... five at most Sessions are intended for totally disjoint things you are working on, and thus there's no common launch configurations for them. Greetings, Sven
I'm working on the KDevelop IDE.
|
Registered Member
|
thi script work with other file other python?
i try it with php but not open kdevelop... For test i have created a script bash, chmod permission for execute, right click on the file, open with and select the bash script. |
Global Moderator
|
I didn't fully understand that, but yeah, if you modify the script appropriately you can also use it with PHP I guess.
Cheers, Sven
I'm working on the KDevelop IDE.
|
Registered users: Bing [Bot], daret, Google [Bot], Sogou [Bot]