1. euphoria config fail
- Posted by ryanj Jan 13, 2015
- 1461 views
I started using eu.cfg in my Redy Project to ensure that any Redy application will run using the specified version of redylib, for two reasons:
- Each application can use a different version of redylib, so multiple versions can be installed for compatibility purposes. Each application is in it's own folder, so it's copy of eu.cfg can point to the needed version.
- It allows people to run Redy without any Euphoria configuration changes to include paths or moving files to an /include folder.
But it turns out that it doesn't always work, and i don't know why. It just silently ignores the eu.cfg file and crashes with a bunch of stuff about not finding gui/gui.e etc. It is really frustrating that there is still no way to guarantee a euphoria program will run on anyone's system without manually setting include paths. People try my program, follow the instructions, and it fails to run, so they give up, and i have no idea what to tell them. Either i am doing something wrong with my config technique, or eu.cfg is fundamentally flawed. What am i missing?
The manual says: When Euphoria starts up, it looks for configuration files in the following order:
- For Windows systems
- %ALLUSERSPROFILE%\euphoria\eu.cfg
- %APPDATA%\euphoria\eu.cfg
- %EUDIR%\eu.cfg
- %HOMEDRIVE%\%HOMEPATH%\eu.cfg
- From where ever the executable is run from "<exepath>/eu.cfg"
- Current working directory - "./eu.cfg"
- Command line -C switches
- Euphoria processes every configuration file found, and in the order described above. This means that settings specified in earlier configuration files may be overridden by subsequent configuration files. For example, a configuration file in the current directory will override the same settings in a configuration file in the executable's directory.
- If a configuration file contains a -C switch, the new configuration file specified on that switch is processed before subsequent lines in the old file.
- A configuration file is only ever processed once. Additional references to the same file are ignored. [/quote]
I put a eu.cfg in the same folder as the main .exw file that is being run. The only reason i can think of that it is being ignored is the current working directory is different because of how someone chose to run the program. People have different euphoria configurations, versions, and ways of running programs, such as the command console or a batch file instead of double-clicking an icon. So, how am i supposed to guarantee that my program will use the correct include files? Why should it depend on someone's configuration or current directory?
Requiring manual configuration of include folders seems like a backwards way of doing things, and makes it impossible to provide a portable source-based program that can run on anyone's computer that has euphoria installed. If a program needs certain includes, why can't that program tell euphoria where they are? The "Current working directory" isn't good enough, because the exw being run isn't guaranteed to be in the current working directory! I think Euphoria should also look at "whatever directory the main interpreted file is in" so that it is guaranteed to use the correct include path for that specific program.
Or even better, why can't we have a top-level statement that defines where include paths are for the entire program? For example,
with include "../../redylib_1.1"
It is really frustrating when you have to modify your euphoria environment just to try someone's program, and that just causes people to give up and delete it.
2. Re: euphoria config fail
- Posted by jimcbrown (admin) Jan 13, 2015
- 1428 views
But it turns out that it doesn't always work, and i don't know why. It just silently ignores the eu.cfg file and crashes with a bunch of stuff
Or even better, why can't we have a top-level statement that defines where include paths are for the entire program?
I don't know why this is happening either.
The good news is that there is a simple workaround. Instead of (or in addition to) sticking your configuration into eu.cfg, put it inside of Euphoria code instead.
Just use the following starter program:
system("eui -i hardcoded-path-1 -i hardcoded-path-2 redy.ex arg1 arg2 etc", 2)
The starter program itself doesn't use any include files or other configuration, so it'll definitely run without problems, and then it can pass on the necessart config to the real program.
3. Re: euphoria config fail
- Posted by useless_ Jan 13, 2015
- 1457 views
My cure:
I still use dos batch files to set up each and every app once it's possibly launchable, with directories for it's include files instead of any other app's include files, even if they are the same files. I will make a clean Eu install, put the app's files in it, and only the required includes. The .bat file specifies the paths. Now i know it will always work, on C:, on D:, or sent to another computer.
My proposed fix:
If eu.cfg is made effective, imo Eu*.exe should look in only one place: the app's start directory.
An app that "runs on euphoria" should be in the Eu's drive:\\rootdir\ path, and the app that's standalone should be in it's own drive:\\rootdir\ path, and it's not kosher that those two situations share where they look for include or config files. The standalone app written in Euphoria and installed on E:\ should not go walkabout looking for the Euphoria installation on C:\ or it's cfg file.
useless
4. Re: euphoria config fail
- Posted by mattlewis (admin) Jan 13, 2015
- 1414 views
Just use the following starter program:
On windows, you could configure a shortcut or a batch file. A shell script on other platforms.
Matt
5. Re: euphoria config fail
- Posted by jimcbrown (admin) Jan 13, 2015
- 1399 views
Just use the following starter program:
On windows, you could configure a shortcut or a batch file. A shell script on other platforms.
Matt
Agreed. (I prefer the starter program, however, as it's more portable. For a multiplatform application, you can configure a shortcut/shell script to launch the starter program, and thus keep all the config in one spot. YMMV.)