WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Loading extensions dynamically.  (Read 1759 times)

Offline Sandras

  • Jr. Member
  • **
  • Posts: 53
Loading extensions dynamically.
« on: May 20, 2010, 10:11:22 AM »
Dunno if anybody's talked about it before, but after a (quick) search, I couldn't find anything. Though I do remember some thread about loading extensions in the background after booting up. But Anyway, here's my concept:

When TC boots up, a special script reads a database and according to it's data creates symlinks to a script, which reads the name of the link it was called by and and according to the data in the database loads the needed extension and launches the program of which name it was called with the arguments it was given, when first called.

I know it might be hard to understand what I'm babbling here, so here's an example from a user point of view.

Let's say, I want to play a song. I open my file manager, pick a song and click on it. File manager tries to launch my default music player, say vlc, with the song name as an argument. But vlc is not loaded yet. Not to worry, a symlink to a script which looks somethin like this exists:

#!/bin/sh
TCEDIR=`cat /opt/.appbrowser`
tce-load -i $TCEDIR/`grep $0 /opt/dyna.db | cut -f1 -d":"`
$0 $*

The file manager executes the link which is pointed to the script above, the script loads an extension according to what it finds in the database file. The database entry format is as follows:

extensionname:linkname

Well. Lets look at my database entrys for vlc to clear things a bit more.

vlc:/usr/local/bin/cvlc
vlc:/usr/local/bin/qvlc
vlc:/usr/local/bin/rvlc
vlc:/usr/local/bin/svlc
vlc:/usr/local/bin/vlc
vlc:/usr/local/bin/vlc-wrapper

Finally, I suggest you to read the script I wrote that is attached below. It's quite rough and sketchy, but it get's the work done. I'm posting this here in the hope that this idea could improve TC. The script itself needs a lot of improvement, but if the idea looks good, then I think TC developers could nail it quite easily.

Oh, one more thing, the script that's attached can create the script that loads extensions when requested through a symlink and can also create the databe I was talking about database (it creates the database fro all the extensions loaded at the tome). I wanted to put everything in one place to make it position independatnt.