I have two programs using the same configuration (chatty + pidgin) in ~/.purple but I wish to separate them into different configuration folders.
My goal is to have chatty use only chatty's configuration, but pidgin to use both.
I can do this by calling pidgin with the
-c
argument to give it a specific path for it's configuration directory, which is fine.
But I wish to integrate the chatty configuration into pidgin, but have chatty itself only work on it's own configuration.
To this end I came up with a solution. Instead of having a configuration file (such as which accounts exist/are active, or the contact list) as a regular file, I'd like them to behave like devices (only in userspace) in that if you read from the file, you actually read from a buffer that is created on demand by some script or program similar how reading from a device driver just uses file operations to generate the data for the user transparently as a file.
That script would be more or less calling cat (or equivillant c++/python/whatever code) on chatty's configuration file and a separate file with pidgin's original configuration.
The script/program/driver would also have to handle writing to that file, only altering pidgin's configuration.
Example:
.purple/blist.xml:
ChattyContact1
ChattyContact2
ChattyContact3
.pidgin/blist_pidginOnly.xml:
PidginContact1
PidginContact2
PidginContact3
cat .pidgin/blist.xml
(special file, pipe, device, or similar):
ChattyContact1
ChattyContact2
ChattyContact3
PidginContact1
PidginContact2
PidginContact3
where combined is generated at the time of reading it via some mechanism and/or updated automatically as either file is changed.
This example is simplified and some program logic need to be applied to the file merging since the original files are in XML format.
The file/script/device/pipe/? should also handle writing to it, by some program logic determining which actual file to write to and then do so.
I'm confident with the programming part of this, I just want to know if it is at all possible to have a file on the file system be hooked into some program.
I was thinking about using a named pipe, but that is closed once the input has been processed once. But maybe I don't quite understand named pipes and that is a possible solution.
Asked by FalcoGer
(101 rep)
Jan 21, 2021, 04:16 PM