equal
deleted
inserted
replaced
30 #include "configmanager.h" |
30 #include "configmanager.h" |
31 #include "sisfile.h" |
31 #include "sisfile.h" |
32 #include "sisregistryobject.h" |
32 #include "sisregistryobject.h" |
33 #include "logger.h" |
33 #include "logger.h" |
34 #include "version.h" |
34 #include "version.h" |
35 #include "is_utils.h" |
|
36 |
35 |
37 // ExpressionResult |
36 // ExpressionResult |
38 using namespace Utils; |
37 using namespace Utils; |
39 ExpressionResult::ExpressionResult(const std::wstring& aString) |
38 ExpressionResult::ExpressionResult(const std::wstring& aString) |
40 : iType(EString), iString(&aString) |
39 : iType(EString), iString(&aString) |
106 { |
105 { |
107 if (++iExpressionDepth > KMaxExpressionDepth) |
106 if (++iExpressionDepth > KMaxExpressionDepth) |
108 { |
107 { |
109 iExpressionDepth=0; |
108 iExpressionDepth=0; |
110 std::string error = "SIS File expression too complex\n"; |
109 std::string error = "SIS File expression too complex\n"; |
111 std::string x; |
110 std::string x = wstring2string(iExpEnv.GetPackageName()); |
112 // |
111 // |
113 throw InvalidSis(Ucs2ToUtf8(iExpEnv.GetPackageName(),x), error, SIS_NOT_SUPPORTED); |
112 throw InvalidSis(x, error, SIS_NOT_SUPPORTED); |
114 } |
113 } |
115 |
114 |
116 switch (aExpression.Operator()) |
115 switch (aExpression.Operator()) |
117 { |
116 { |
118 case CSISExpression::EBinOpEqual: |
117 case CSISExpression::EBinOpEqual: |
246 |
245 |
247 case CSISExpression::EPrimTypeOption: |
246 case CSISExpression::EPrimTypeOption: |
248 { |
247 { |
249 iExpressionDepth=0; |
248 iExpressionDepth=0; |
250 std::string error = "SIS File contains user options\n"; |
249 std::string error = "SIS File contains user options\n"; |
251 std::string x; |
250 std::string x = wstring2string(iExpEnv.GetPackageName()); |
252 // |
251 // |
253 throw InvalidSis(Ucs2ToUtf8(iExpEnv.GetPackageName(),x), error, SIS_NOT_SUPPORTED); |
252 throw InvalidSis(x, error, SIS_NOT_SUPPORTED); |
254 } |
253 } |
255 |
254 |
256 case CSISExpression::EPrimTypeNumber: |
255 case CSISExpression::EPrimTypeNumber: |
257 iTempResult = ExpressionResult(aExpression.IntValue()); |
256 iTempResult = ExpressionResult(aExpression.IntValue()); |
258 break; |
257 break; |
259 |
258 |
260 default: |
259 default: |
261 { |
260 { |
262 iExpressionDepth=0; |
261 iExpressionDepth=0; |
263 std::string error = "SIS File contains unknown expression\n"; |
262 std::string error = "SIS File contains unknown expression\n"; |
264 std::string x; |
263 std::string x = wstring2string(iExpEnv.GetPackageName()); |
265 // |
264 // |
266 throw InvalidSis(Ucs2ToUtf8(iExpEnv.GetPackageName(),x), error, SIS_NOT_SUPPORTED); |
265 throw InvalidSis(x, error, SIS_NOT_SUPPORTED); |
267 } |
266 } |
268 } |
267 } |
269 |
268 |
270 --iExpressionDepth; |
269 --iExpressionDepth; |
271 return iTempResult; |
270 return iTempResult; |
314 } |
313 } |
315 fileName = L"Z:" + fileName; |
314 fileName = L"Z:" + fileName; |
316 } |
315 } |
317 |
316 |
318 // Require for invalid file exception (also helps with debugging) |
317 // Require for invalid file exception (also helps with debugging) |
319 std::string narrowFileName; |
318 std::string narrowFileName = wstring2string( fileName ); |
320 narrowFileName = Ucs2ToUtf8( fileName, narrowFileName ); |
|
321 |
319 |
322 // Now continue with file, assuming we've fixed up the path or then |
320 // Now continue with file, assuming we've fixed up the path or then |
323 // have enough characters to process |
321 // have enough characters to process |
324 bool startsWithDrive = StringUtils::StartsWithDrive( fileName ); |
322 bool startsWithDrive = StringUtils::StartsWithDrive( fileName ); |
325 if ( startsWithDrive ) |
323 if ( startsWithDrive ) |
343 // File is on 'C:' so merge with C-drive specification and |
341 // File is on 'C:' so merge with C-drive specification and |
344 // use native FileExists() check |
342 // use native FileExists() check |
345 ConvertToLocalPath( fileName, iCDrive ); |
343 ConvertToLocalPath( fileName, iCDrive ); |
346 |
344 |
347 // For debugging |
345 // For debugging |
348 narrowFileName = Ucs2ToUtf8( fileName, narrowFileName ); |
346 narrowFileName = wstring2string( fileName ); |
349 |
|
350 fileExists = FileExists( fileName ); |
347 fileExists = FileExists( fileName ); |
351 break; |
348 break; |
352 } |
349 } |
353 } |
350 } |
354 } |
351 } |
361 if(aLogInfo) |
358 if(aLogInfo) |
362 { |
359 { |
363 std::ostringstream stream; |
360 std::ostringstream stream; |
364 stream << "\tIF EXISTS(\'" << narrowFileName << "\') => " << fileExists; |
361 stream << "\tIF EXISTS(\'" << narrowFileName << "\') => " << fileExists; |
365 std::string msg = stream.str(); |
362 std::string msg = stream.str(); |
366 std::wstring finalMessage = Utf8ToUcs2( msg ); |
363 std::wstring finalMessage = string2wstring( msg ); |
367 LINFO( finalMessage ); |
364 LINFO( finalMessage ); |
368 } |
365 } |
369 // |
366 // |
370 return fileExists; |
367 return fileExists; |
371 } |
368 } |
426 if(aLogInfo) |
423 if(aLogInfo) |
427 { |
424 { |
428 std::ostringstream stream; |
425 std::ostringstream stream; |
429 stream << "Input language " << result << " is not supported by SIS file. Using first language " <<firstLanguage; |
426 stream << "Input language " << result << " is not supported by SIS file. Using first language " <<firstLanguage; |
430 std::string msg = stream.str(); |
427 std::string msg = stream.str(); |
431 std::wstring finalMessage = Utf8ToUcs2( msg ); |
428 std::wstring finalMessage = string2wstring( msg ); |
432 LWARN( finalMessage ); |
429 LWARN( finalMessage ); |
433 } |
430 } |
434 result = firstLanguage; |
431 result = firstLanguage; |
435 } |
432 } |
436 } |
433 } |
437 if(aLogInfo) |
434 if(aLogInfo) |
438 { |
435 { |
439 std::ostringstream stream; |
436 std::ostringstream stream; |
440 stream << "\tIF " << attributeName << " ... where [" << attributeName << " = " << result << "]"; |
437 stream << "\tIF " << attributeName << " ... where [" << attributeName << " = " << result << "]"; |
441 std::string msg = stream.str(); |
438 std::string msg = stream.str(); |
442 std::wstring finalMessage = Utf8ToUcs2( msg ); |
439 std::wstring finalMessage = string2wstring( msg ); |
443 LINFO( finalMessage ); |
440 LINFO( finalMessage ); |
444 } |
441 } |
445 } |
442 } |
446 else if ( aVariableId == KVariableLanguage ) |
443 else if ( aVariableId == KVariableLanguage ) |
447 { |
444 { |
451 } |
448 } |
452 result = 1; |
449 result = 1; |
453 } |
450 } |
454 else |
451 else |
455 { |
452 { |
456 std::string packageName; |
453 std::string packageName = wstring2string( GetPackageName() ); |
457 packageName = Ucs2ToUtf8( GetPackageName(), packageName ); |
|
458 // |
454 // |
459 std::string error = "SIS File contains HAL attributes\n"; |
455 std::string error = "SIS File contains HAL attributes\n"; |
460 throw InvalidSis( packageName, error, SIS_NOT_SUPPORTED ); |
456 throw InvalidSis( packageName, error, SIS_NOT_SUPPORTED ); |
461 } |
457 } |
462 // |
458 // |