pjheslin / diogenes

Diogenes: an environment for reading Latin and Greek
https://d.iogen.es/d
Other
57 stars 11 forks source link

Reading database locations from environment variables #55

Closed daphniz closed 4 years ago

daphniz commented 4 years ago

It may be a good idea to let diogenes-cli read database locations from environment variables (or something). Adding it as an argument every time is a bit cumbersome. Or perhaps there's another way I've overlooked?

pjheslin commented 4 years ago

You can set the environment variable Diogenes_Config_Dir to a directory which has a file called diogenes.config, where you can set the locations of the databases. Or you can just put that file in the default location for your platform and forget about the environment variable. The per-user default directory locations are:

~/.diogenes (Linux) ~/Library/Application Support/Diogenes/ (Mac) It's more complicated in Windows, but depending on your version it's probably C:\MyUserName\AppData\Roaming\Diogenes

daphniz commented 4 years ago

Thanks. What's the format of diogenes.config? Does it work for xml-export.pl as well? I'm trying to use this on a host I don't have root on, ie. without installing. It doesn't seem to have a -D option as diogenes-cli.

daphniz commented 4 years ago

PS. I suppose one is supposed to use the GUI programmes and set the locations there, but perhaps making ~/.local/share/tlg &c. the default, and looking in /usr/share/tlg &c. if those didn't exist would be good.

pjheslin commented 4 years ago

For the three databases, the lines in the config file should read:

tlg_dir "/path/to/tlg/" phi_dir "/path/to/phi/" ddp_dir "/path/to/ddp/"

That will work for xml-export.pl, which does not have the facility to set the paths to the databases on the command-line.

If I were to supply a default path for each of the three databases, it would have to be a different default for each of the three platforms on which Diogenes runs, so with 9 defaults it's a bit complicated.

You don't need to have root to install the GUI on Linux. You can't use the .deb or .rpm packages, but it should be straightforward to install by hand. Download the arch package and unpack it. Change to the newly created usr/local/diogenes/ subdirectory of your current dir and run the diogenes executable. I haven't tested this, but it should work on any modern Linux box.