PDA

View Full Version : FeatureAddItem Problem



rudy079
05-05-2004, 08:36 AM
Hello,

I have a comma delimited text file which basically is a feature I want to add to the installation. (One line is one feature, each part of the feature is broken up by commas)

I can get each part of the feature fine, and the FeatureAddItem succeeds, but whenever I try and view the features, nothing comes up. Code is below:

while (GetLine (nFileHandle, svLine) = 0)
FileInfo = ListCreate ( STRINGLIST );
StrGetTokens ( FileInfo, svLine, "," );

ListGetFirstString (FileInfo, svString);
fName = svString;
ListGetNextString (FileInfo, svString);
fFile = svString;

ListGetNextString (FileInfo, svString);
StrToNum ( fSize, svString );

nResult = FeatureAddItem ( MEDIA, "Maps"^fName, fSize, FALSE );
if(nResult < 0) then
FeatureError(svString, fName, szMsg, fFile, nFileHandle);
NumToStr(fName,nFileHandle);
MessageBox (fName, SEVERE);
endif;

nResult =FeatureSetData ( MEDIA, fName, FEATURE_FIELD_HTTPLOCATION, -1, fFile );
if(nResult < 0) then
FeatureError(svString, fName, szMsg, fFile, nFileHandle);
NumToStr(fName,nFileHandle);
MessageBox (fFile + ": " + fName, SEVERE);
endif;
endwhile;


SdFeatureTree ("Map Selection", "Please choose which maps to install:", TARGETDIR, MEDIA, 10);

Am I missing something obvious?

Thanks for the help.

RobertDickau
05-05-2004, 09:09 AM
I believe FeatureAddItem requires you to create a "script-based" media set, meaning you'll need to temporarily modify the value of the MEDIA system variable before calling FeatureAddItem, or (equivalently) change the string you pass as the first argument to FeatureAddItem...

rudy079
05-05-2004, 10:25 AM
Okay, I did get it to work, only problem is the sizes are all reported as 1k, even after I manually set them. Any ideas?


-------------

Okay fixed that... is there a way to use Megabytes in the dialog instead of Kilobytes?

------------

Nevermind, fixed that to, thanks for your help