It is currently Fri Dec 05, 2008 2:56 am

All times are UTC - 8 hours




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Packages()
PostPosted: Sat Sep 23, 2006 8:02 am 
Offline

Joined: Wed Aug 30, 2006 5:24 pm
Posts: 82
Location: Italy
Now packages report name sopports_http and npcdesc
Have on report all info loaded in pkg.cfg ?

_________________
Admin/Scripter Innominabile
ZuluHotelItalia shard on m4d


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 09, 2006 5:44 pm 
Offline
POL Developer
User avatar

Joined: Wed Jan 25, 2006 2:30 am
Posts: 430
Location: San Diego, California
None of that is really stored, with the exception of the package name, and its version.

The solution to use it would be make an include that uses file.em and read it in that way.

Code:
use os;
use file;

/*
* GetPackageCfgInfo(pkg_name)
*
* Purpose
* Reads a pkg.cfg for a package and returns its information.
*
* Parameters
* pkg_name:   Name of the package to retrieve the information for.
*
* Return Value
* Returns a dictionary on success.
* Returns an error on failure.
*
*/

function GetPackageCfgInfo(pkg_name)
   var info := dictionary;
   var pkgfile := ReadFile(":"+pkg_name+":pkg.cfg");
   if ( pkgfile.errortext )
      return pkgfile; // Contains an error.
   endif

   foreach line in ( pkgfile )
      var parsed := SplitWords(line);
      var key := parsed[1];

      var pos := Find(line, parsed[2], Len(parsed[1])+1);
      var value := line[pos, Len(line)];

      info[key] := value;
      SleepMs(2);
   endforeach

   return info;
endfunction

_________________
-Austin


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 11, 2006 10:05 am 
Offline

Joined: Wed Aug 30, 2006 5:24 pm
Posts: 82
Location: Italy
Thanks :-))) Very nice.

_________________
Admin/Scripter Innominabile
ZuluHotelItalia shard on m4d


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl