• Welcome to OS2World OLD-STATIC-BACKUP Forum.
 

News:

This is an old OS2World backup forum for reference only. IT IS READ ONLY!!!

If you need help with OS/2 - eComStation visit http://www.os2world.com/forum

Main Menu

Use EA to store information and settings

Started by jep, 2008.04.10, 13:03:21

Previous topic - Next topic

jep

Marked as: Normal
Hello,

At times you may want to store information between each run. It can improve performance so you don't have to use code that serach for files and information that is already known from earlier and it can serve as a storage of data that you want to hide form the user, at least a bit.

Remember that you can't use this method to set data on executables that run as they're "locked", but you can use a dummy ini-file and store info in the EA of that one intead.

/* Read/Save info from/to Extended Attributes */

parse source . . prog

if SysGetEA( prog, '.settings_plugin', 'plugin' ) = 0 then
  if length( plugin ) = 0 then do
    plugin = value( 'ETC',, 'ENVIRONMENT' )'\settings.plg' /* if not found, search or define where it should be placed */
    say "Plugin will be placed in "plugin
  end
  else say "Information read from EA ("plugin")"

if SysPutEA( prog, '.settings_plugin', plugin ) = 0 then
   say "Information has been saved to EA of "prog
else
   say "It wasn't possible to write the information to "prog