File Extension Registry


fearofshorts

Member
Joined
Nov 14, 2009
Messages
244
Age
32
Location
Australia
I was wondering... how does the Pandora's OS handle file extension registration?
With a normal system the OS allows programs to become associated with particular file extensions, but I can't see how the Pandora could do this (because of the roaming nature of the PND specifications).

Is there any place in the specs to allow this to happen? Will we be able to configure the OS to use an executable automatically when trying to open particular file types? (eg: The user taps a .txt, and the OS sends it to the executable in Abiword.pnd).

I don't mind if it's a bit hard to set up, as long as it's possible.
 
yes, this is already in there

git.openpandora.org / pandora-libraries.git / docs / PXML_proposed_spec.html (Section 2.11)

Example
Code:
<associations>
  <association name="Open Bitmap Image" filetype="image/bmp" exec="-f %s --no-deinterlacing"/>
  <association name="Crash the computer with a stylesheet" filetype="text/css" exec="-f %s --crash-on-success"/>
</associations>
 
Ah! Thank you!
But does that work when the program is not running? Or will we have to boot the program, then the files?

EDIT: also, great example. If only it were possible, it would be so much fun to send a PND with that to any really annoying people in the community who appear post-release...
 
As you can see this will start the application in the PND file with the given parameters.
Its up to the application to handle this either by using an existing instance or by creating a new one or whatever it likes to do.

This is exactly the same you get with most other distros.
 
FWIW, I'll inform you some more about files in Linux.

In e.g. Windows, file handlers go strictly by file extension, so if a file has the extension ".jpg" it'll be opened as a JPEG image, and if it lacks an extension it can't be opened.

The way Linux normally handles this is instead as follows:
  • Every file has a type that is specified by "kind of file/format of file" e.g. "image/jpeg", "application/msword" or "text/html"
  • The system uses a library called "libmagic" to detect the type of a given file. So, libmagic scans the file and decides that it's type is e.g. "image/png". It *does not* care about the extension of the file (so the file "myhouse.exe" will still be opened like a PNG file if it's a PNG file that someone renamed to ".exe").
  • One of many configuration files specify which application is to be launched for the specified type. There are various contexts that have to be considered, e.g. you don't want to open a file with a GUI application if you're in a terminal, and if you use KDE you don't want to open files with Gnome programs.
  • The PND system just hooks into this association system and adds PND-hosted applications as file type handlers.

EDIT: Also, apropos the PXML spec; the most up-to-date version is here:
http://pandorawiki.org/PXML_specification

(the one in the GIT is one I wrote about a year ago and is very out of date)
 
Roaming? Interesting choice of nebulous words :)

Current the pnd and PXML magic is not implemented for automatica file associations, but we'll get there. Someone will add it, but its not in there yet.

It is also not had to add new associations (its trivial), and normal users can do it as well generally, as in Windows .. using a GUI. But the actual association info is just in a file in the system.

jeff
 
Back
Top