![]() Registered Member ![]()
|
Hello community,
I created a small KDE Service menu in order to use the export to pdf function of Libreoffice (I use libreoffice 4.1.4 installed in /opt from the debs provided by the Document Foundation web page. I use KDE4.8 on Debian Wheezy 64bit, but would want this to also work on OpenSuse 12.3 KDE 4.10 . The Service Menu is the following:
The service menu works fine. However, it exports the pdf to the ~/Documents folder irrespective of where the file I apply it on is located. On the contrary, if I run the same command on the command line
the pdf is exported to the directory where the original is located. How could I change my Service Menu in order to also use the directory of the original file? Thank you! |
![]() Administrator ![]()
|
Chances are Libreoffice is simply exporting the file into the "current working directory". The easiest way to fix this would be to use a wrapper script around it, which runs the following before executing Libreoffice. $1 in this case is the first argument to a shell script, which would be %f.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
Hello Ben,
thank you for the answer.
This seems to be true, as it is exactly what it does when executing the above command on the terminal. I am not exactly sure I understood your answer though. My bash scripting skills are unfortunately rather limited. I experimented with basename. As I understand it, it would return the filename and not the path, did I misread something? I found however that dirname would provide the path. This:
seems to work. Thank you! |
![]() Administrator ![]()
|
Oops - I got my directives confused. Yes - dirname is what should be used in this case.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered users: Bing [Bot], Google [Bot], lockheed