Marc Weustink wrote 12 lines
+ From:
+ Behalf Of Curtis White
+
+ Actually, this is a good idea. We could have a function in
+ the LCL that returns the path to the configuration directory
+ ( getConfigPath() ). In Win32, it could return the path where
+ Lazarus is installed and in Linux it could return the
+ ~/.lazarus path.
I think not as a part of the LCL. You only need the config for Lazarus it
self. Other applications crated by Lazarus have their own config path.
But the LCL is currently the only place were we differentiate between OS platforms. If we don't put it into the LCL somewhere, then we must start making Lazarus have different versions for each OS. This has nothing to do with other applications. It is just a service the LCL is providing to Lazarus. Other applications can worry about their own paths. I don't think everything in the LCL has to be provided strictly for end users does it? Can't we build things into the LCL that will also help us build Lazarus?
Show quoted text 9 lines
+ On Linux it is easy because you
+ just look for ~ and depending on what user is logged on you
+ get the path to their home directory. I think Win32 is going
+ to be a little more difficult.
In win32 it is common to store your config in the same dir as the exe
(default config). Project specific confuguration goes to your project dir.
But the bigger problem is that it is different on Linux. So we must somehow provide a way for Lazarus to find the path to its config files on Linux and also on Win32. And we need to do this without having two versions of Lazarus and also without using IFDEFs. So the only other way I can think of is to provide a function in the LCL, where we compile it different for each OS, that will tell us how to find the config path.
We don't need to hard code the paths. We just need to define the rules differently. On Linux, it needs to look in ~/ first, then /etc, then use the defaults. On Windows it needs to look in the directory where the exe is installed, then in windows\system, then use the defaults. Notice, that the rules are different and will most likely be different still again if we ever create Lazarus for another platform like OS2, Mac, etc. So to me it makes the best sense to put this into the LCL where we already distinguish the difference between OS's.
I am open to any other suggestions that anyone might have. For now, I will go ahead and code a function into the LCL that will define the rules for the config path. Maybe we need some sort of TLazarus class in the LCL that is designed to hold code created specifically for Lazarus and not to be used by other programs????
Curtis