OS2 World.Com Forum
2012.05.24, 21:00:41 *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Use EA to store information and settings  (Read 1199 times)
jep
Global Moderator
Sr. Member
*****
Posts: 402


View Profile
« on: 2008.04.10, 13:03:21 »

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.

Code:
/* 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
« Last Edit: 2009.06.11, 09:21:04 by jep » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.14 | SMF © 2006-2011, Simple Machines LLC
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!