Emerald Editor Discussion
July 20, 2017, 09:43:59 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Storing Preferences  (Read 7450 times)
0 Members and 1 Guest are viewing this topic.
daemon
Developers
Gem Cutter
***
Posts: 107


WWW
« on: June 02, 2006, 02:15:11 am »

How should preferences be stored in EE? Normally, Mac OS X stores preferences in ~/Library/Preferences/ named as a reverse-qualified domain; Windows usually does writes to the registry; and *NIX usually saves the file in ~/.emeraldeditor.

Should this be how we store our data? Currently, saving of preferences is disabled in EE because we haven't specified a place to put them. I don't know anything about Windows development, so I'll be useless when it comes to the registry. However, I can take care of both *NIX and OSX. Should we just use a file for Windows, too (in what location, though?) so we don't have to create a separate config writer for different platforms?
« Last Edit: June 03, 2006, 06:31:49 pm by daemon » Logged
Arantor
Site Administrator
Administrator
Master Jeweller
*****
Posts: 618



« Reply #1 on: June 02, 2006, 12:31:27 pm »

Well, we could write to the registry (it involves calling several C++ classes, to open a Registry key, query it, write it if necessary, then close it again - opening a large application like Paint Shop Pro can generate 10,000 registry operations) but I'd prefer to be as non-invasive as possible.

There is no reason we have to rely on the registry, and it seems to me that if we can keep the configuration file as similar between platforms as possible, which reduces the code requirement and also keeps it cleaner.

Under Windows, your choices would be something like: (Windows specifies environment variables enclosed in percentage signs, btw)
%WINDIR%/emerald.ini
  (translates typically to C:\Windows\emerald.ini or C:\Winnt\emerald.ini, good for systemwide applications; ScummVM for example does this)
%HOMEDIR%/emerald.ini
  (translates typically to C:\Documents and Settings\username\emerald.ini - only on WinNT, Win2000, WinXP, and possibly Vista?! while Win9x seems to resolve %HOMEDIR% to nothing or possibly to C:\Windows or equivalent)

Another approach, which seems to be common (e.g. Gaim on Windows) puts it into:
%HOMEDIR%/Application Data/Emerald Editor/

Should we need more than one file this would prove handy. Alternatively .../emerald.ini would be fine.

Wouldn't the path be builtin at compile time? (with compile-time configuration - IFDEF Windows - or whatever the exact syntax is)

alpha's initial builds of Emerald, where the code was a straight mod of wxStEdit, dumped wxstedit.ini in the same directory where the binary was run from.

Ideally the final filename should be left to less than 8 characters with up to 3 characters extension, simply to avoid any aggravation on Windows.
Logged

"Cleverly disguised as a responsible adult!"
Zhrakkan
Official Mascot!
Beta Testers
Gem Cutter
***
Posts: 177



WWW
« Reply #2 on: June 02, 2006, 06:34:02 pm »

I am a windows admin and we can do the preferences a few ways...
1)  Registry
2)  Home Drive
3)  The EE program folder

We have benefits and problems with each.

Registry
Using the registry means that using a thumbdrive for a long term is not something you wanna do.
Why use the registry?

Home Drive
All users have a home drive when they login to the account.
Like Arantor said, - %HOMEDIR%/Application Data/Emerald Editor/ could be a great choice to go.
Its simple, and not editing anything other than this one file or two, how ever many files the preferences will be.  This is also good since the user already has CHANGE access to the folder, even in a locked down environment

EE Program Folder
This is a GREAT place to put it especially when trying to create a app that can be put on a USB drive and moved from place to place, retaining your preferences.  The problem with this is, in ANY locked down environment, the user will most likely not have access to C:\program files\Emerald editor to either install the app or make changes to the folder, so this is a huge problem with this solution.

I am not a supporter of using the windows folder or the registry, there is already too much crap there anyways.

I support the Home Drive or EE Program folder.

Thinking forward, most people using this WILL have admin rights to their own computer, so using the Program folder I dont think will be much of an issue...

Those are my 2 cents.
Logged

News Manager and Unofficial Mascot
Join the Emerald Editor Project - Message Me!
Emerald Editor - "A Jewel of an Editor"
-----by the way, that name is pronounced "Za-Rack-In"
Arantor
Site Administrator
Administrator
Master Jeweller
*****
Posts: 618



« Reply #3 on: June 02, 2006, 06:54:37 pm »

Quote from: Zhrakkan
This is a GREAT place to put it especially when trying to create a app that can be put on a USB drive and moved from place to place, retaining your preferences.  The problem with this is, in ANY locked down environment, the user will most likely not have access to C:\program files\Emerald editor to either install the app or make changes to the folder, so this is a huge problem with this solution

Very true - I know a couple of users who were posting on the CE forums who were after a solution which did not write to %WINDIR% or %CWD% (current working directory, i.e. EE folder)
Logged

"Cleverly disguised as a responsible adult!"
Zhrakkan
Official Mascot!
Beta Testers
Gem Cutter
***
Posts: 177



WWW
« Reply #4 on: June 02, 2006, 07:37:33 pm »

After looking at this, I am all for making this simple.
Create a EE.ini file or something where the perms are stored in the program folder.

This way, its really eay to also BACK UP preferences as well.  I think the biggest negative on this one is the locked down users environment issue.
Logged

News Manager and Unofficial Mascot
Join the Emerald Editor Project - Message Me!
Emerald Editor - "A Jewel of an Editor"
-----by the way, that name is pronounced "Za-Rack-In"
Arantor
Site Administrator
Administrator
Master Jeweller
*****
Posts: 618



« Reply #5 on: June 02, 2006, 07:41:53 pm »

It does also depend on whether EE will be deployed in a multi-user environment on Windows XP (for example), since applying it to the EE program directory applies it to every user on the system, which is why I was aiming a little towards the home directory.

It's still easy enough to back up preferences if stored there - especially if you are a good user and do your backups regularly  Wink
Logged

"Cleverly disguised as a responsible adult!"
awmyhr
Senior Miner
***
Posts: 95

Maintainer of Obscure and Unused Ports


WWW
« Reply #6 on: June 02, 2006, 09:56:10 pm »

It should be very easy to use the platforms native method (in the case of OSX and *NIX, looks like daemon has it taken care of).  It shouldn't be too hard in the Windows version to write the code so it looks for %HOMEDIR% first, then the programs own directory second.  I'd vote to default to users home directory, but provide option to put it in programs dir (or anywhere else).  This would be the way to be a 'good citizen' in a multi-user environment.

As far as the 'thumbdrive' crowd is concerned, here is one way to approach it.  Have an option called 'enable thumbdrive mode.'  When clicked, this would place a hidden file in the same directory as the executable which would simply be the path to the prefs file.  Of course, on startup the program would have to check for this file every time...
Logged

-->>  This Space 4 Rent  <<--
Feldon
Gem Cutter
****
Posts: 106


« Reply #7 on: June 03, 2006, 02:44:06 pm »

Re: Windows...

Considering that Windows Vista is going to start increasing the number of users not running as Admin, it might be more prudent to use the users home directory.  The GIMP stores some personal settings in "Documents and Settings\<User Name>\.gimp", but most of the apps seem to use "Documents and Settings\<User Name>\Application Data\<App Name>".  I'd go with that.
Logged
alpha
Developers
Senior Miner
***
Posts: 78


« Reply #8 on: June 05, 2006, 02:49:23 am »

Please also see this thread:
http://forum.emeraldeditor.com/index.php?topic=7.0

Markus Schulz
Logged
daemon
Developers
Gem Cutter
***
Posts: 107


WWW
« Reply #9 on: June 05, 2006, 04:07:37 am »

Another option could be if you hold down alt/option during startup, you can select your own configuration file.
Logged
Feldon
Gem Cutter
****
Posts: 106


« Reply #10 on: June 05, 2006, 04:32:01 am »

Another thread got me thinking some more about this.  If we want to support multiple users it would be easier if we simply stored the configuration files in that users home directory.  I think this should be the default method.  However, there could always be an option during installation for some kind of stand-alone install instead?  Or alternatively, a single-user install?  I'm not sure what that would look like for a Linux or Mac install but I've seen it done for Windows.
Logged
Arantor
Site Administrator
Administrator
Master Jeweller
*****
Posts: 618



« Reply #11 on: June 05, 2006, 02:46:58 pm »

From a technical perspective, you'd handle a single user thusly in Linux (and presumably something similar in Mac OS X...), it would live in /etc/emerald.rc or /etc/emerald/.mainrc or something, instead of /home/user/.emeraldrc or /home/user/.emerald/.mainrc

Therefore it is doable, but I would imagine the most logical way is to provide a set of defaults (inbuilt), and save them to /home/user/.emeraldrc for Linux.

That way you have defaults for the user. As for a standalone, we could either:
a) provide a commandline option for that (e.g. --no-config)
b) provide a separate binary

The only issue with b) is that it instantly doubles any building we do for release purposes.
Logged

"Cleverly disguised as a responsible adult!"
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.25 seconds with 18 queries.