Dolphin starts programs with a wrong current directory

Stephen Dowdy sdowdy at
Mon Dec 14 00:45:30 GMT 2009

Torsten Frey wrote, On 12/13/2009 05:16 PM:
>> Perhaps it's my inability at explaining myself clearly that all replies
>> miss the point.
>> Anyway, I am letting this rest and consider myself happy that everyone
>> concerned runs Gnome and XP and let Dolphin have its "*ix way."
> Hi Nikos,
> I tried this - as I have understood your problem! If that does not fit I 
> apologize.
> I created a little textfile test.txt with content "Hello World".
> I created a little bash-script "" 
> My (your?) goal is to open the "application" ""  with the test.txt that 
> is in the same directory.
> #!/bin/bash
> ./kate test.txt

feel free to ignore me, as ...
I missed the first part of this thread, but i am gleaning that Nikos
is upset that launching an application from the window manager does
not change the current-working-directory to the directory that the
application launched from is held in for the spawned process.
(in the script above, perhaps a
  'kdialog --msgbox "I am in directory $(pwd) ($(pwd -P))"'
would provide you
with the directory that it's launched in (i'm guessing either ${HOME}
(or wherever kde session was started) or some kde default dir)).

I am not going to argue the merits of whether that is the correct
or even desireable operation, but i see Nikos' point if i'm getting it.
(or whether it's even true, i have no KDE4 systems to test)

I am, however, going to say that i don't write code that presumes
that the data files it needs are in the current working directory.
Either make the program change directory to its own location, or
define static (or dynamic, referenced from the program location)
symbols/variables referring to the data location.

if in a script...

# Where are we called from?
this_prog="$(readlink -f $0)"
this_dir="$(dirname ${this_prog})"

# Let's make sure we're in the top-dir
cd "${this_dir}"


   kate ${this_dir}/test.txt


or use argv[0] with libcall readlink() in 'C', etc...

This message is from the kde mailing list.
Account management:
More info:

More information about the kde mailing list