You are not logged in.

  • "SimonBlackham" started this thread

Posts: 3

Location: New Forest - UK

Occupation: Tecchie

  • Send private message

1

Wednesday, June 15th 2005, 11:47am

Launching a Wish script on a CD

Distributing updates of data and software we use TCL/Tk (Wish) scripts on the CD (with Wish on the CD for Windows systems) - but the problem can arise with any linked launch anywhere in an unknown system.

Problem now arises with the use of hald (??) mounting the CD on /media/<CD-Label>.

We start the wish script by getting the user to click a link to application in the CDROM window. Originally the CD was always mounted on /media/cdrom or other known mount point - so although the scripts working directory was the users home - it looked around and found itself on the CD to determine its working directory.
There were a number of links with their icons in different places - eg /media/cdrom/<iconfile> - and the correct one would show its icon - an inelegant solution - but manageable.
For testing - the system works from any directory on a system - if it knows its 'PWD'.
Unfortunately - if you click the link or script in Konqueror - it will start in the users home directory. If you add a terminal to the Konqueror screen and start it there ($ wish Update.tcl) - the working directory is the launch directory and the script can get it with '[pwd]'.
You cannot set the working directory to '$PWD' in the link definition - only to existing directories - and they are on the development machine anyway when the link is created.

Currently the script looks into all the mount points on /media for itself to determine where it is - another inelegant solution - development launches have to be from a terminal.
-------
I have since noticed that the <CD-label> is taken from the first session for multisession CDs.
We like to use links so that we can apply icons to the called script that relates to its functionality and will draw the (dumb) users attention to it - not to its mime type or content.
Simon

This post has been edited 1 times, last edit by "SimonBlackham" (Jun 15th 2005, 4:07pm)


anda_skoa

Professional

Posts: 1,273

Location: Graz, Austria

Occupation: Software Developer

  • Send private message

2

Thursday, June 16th 2005, 2:48pm

Oh, boy, this sounds like a terribly broken mount setup.

What does it do if you insert two CDs with the same label at the same time?

Anyway, you already got a reply on the mailinglist, suggesting to use the first commandline argument to get the invokation command, including the path.

I don't see how this is related to KDE though.

Cheers,
_
Qt/KDE Developer
Debian User

  • "SimonBlackham" started this thread

Posts: 3

Location: New Forest - UK

Occupation: Tecchie

  • Send private message

3

Tuesday, June 21st 2005, 12:33pm

multiple mounts

It increments the mount point with _1 _2 etc


I couldn't decide if it was hald or kde doing it - it is launched with a kde link to a device - so I thought I would get a quicker reply here.

This is standard SuSE 9.3 (Novell) distro.

The command line argument doesn't get over the problem of the KDE (application) link not being able to set its working directory to its launch directory. eg you cannot tell the link to get its icon from the CD - as it will set it to the current users home directory if undefined - and '$PWD' is not resolved at launch.
Simon

This post has been edited 2 times, last edit by "SimonBlackham" (Jun 21st 2005, 12:41pm)


anda_skoa

Professional

Posts: 1,273

Location: Graz, Austria

Occupation: Software Developer

  • Send private message

4

Tuesday, June 21st 2005, 4:15pm

cd dirname $0

Cheers,
_
Qt/KDE Developer
Debian User

  • "SimonBlackham" started this thread

Posts: 3

Location: New Forest - UK

Occupation: Tecchie

  • Send private message

5

Wednesday, June 22nd 2005, 10:09am

launching application on a CD

I will try 'cd $PWD; <application>' in the application launcher.

cd [pwd] (which is the first command in the script) - doesn't work in wish as the launcher has already switched to the users home.
A 'cd <dirname>; $0' relaunch doesn't work as it is <dirname> (or rather <pathname>) that you don't know !
Simon

anda_skoa

Professional

Posts: 1,273

Location: Graz, Austria

Occupation: Software Developer

  • Send private message

6

Wednesday, June 22nd 2005, 12:14pm

Sorry

Source code

1
cd $(dirname $0)


man dirname

Cheers,
_
Qt/KDE Developer
Debian User