equal
deleted
inserted
replaced
26 // User include |
26 // User include |
27 #include "commandparser.h" |
27 #include "commandparser.h" |
28 #include "interpretsis.h" |
28 #include "interpretsis.h" |
29 #include "logger.h" |
29 #include "logger.h" |
30 #include "../common/exception.h" |
30 #include "../common/exception.h" |
|
31 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
32 #include "dirparse.h" |
|
33 #endif //SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
31 |
34 |
32 int main(int argc, const char* argv[]) |
35 int main(int argc, const char* argv[]) |
33 { |
36 { |
|
37 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
38 std::string dbpath; |
|
39 #endif |
34 bool pauseWhenDone = false; |
40 bool pauseWhenDone = false; |
35 |
41 |
36 int result= SUCCESS; |
42 int result= SUCCESS; |
37 std::wofstream* logFile = NULL; |
43 std::wofstream* logFile = NULL; |
38 try |
44 try |
58 |
64 |
59 Logger::SetLevel( options.WarningLevel() ); |
65 Logger::SetLevel( options.WarningLevel() ); |
60 |
66 |
61 CInterpretSIS interpretSis(paramList); |
67 CInterpretSIS interpretSis(paramList); |
62 |
68 |
|
69 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
70 if ( paramPtr->IsFlagSet(CParameterList::EFlagsResourceFilePathSet)) |
|
71 { |
|
72 ParseResourceDir(paramPtr, interpretSis); |
|
73 |
|
74 if (NULL != logFile) |
|
75 { |
|
76 bool val = logFile->is_open(); |
|
77 logFile->close(); |
|
78 delete logFile; |
|
79 } |
|
80 return result; |
|
81 } |
|
82 else |
|
83 { |
|
84 ParseResourceDir(paramPtr, interpretSis); |
|
85 } |
|
86 #endif //SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
87 |
63 result = interpretSis.Install(); |
88 result = interpretSis.Install(); |
64 |
89 |
65 // Uninstall the sis files |
90 // Uninstall the sis files |
66 interpretSis.Uninstall(); |
91 interpretSis.Uninstall(); |
|
92 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
93 if(result != 0) |
|
94 dbpath=GetDbPath(paramPtr); |
|
95 #endif |
67 } |
96 } |
68 catch( CCommandParser::CmdLineException err ) |
97 catch( CCommandParser::CmdLineException err ) |
69 { |
98 { |
70 CCommandParser::DisplayError(err); |
99 CCommandParser::DisplayError(err); |
71 result = CMDLINE_ERROR; |
100 result = CMDLINE_ERROR; |
80 { |
109 { |
81 LERROR(L"Config Manager Error - "); |
110 LERROR(L"Config Manager Error - "); |
82 e.Display(); |
111 e.Display(); |
83 result = CONFIG_ERROR; |
112 result = CONFIG_ERROR; |
84 } |
113 } |
|
114 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
115 catch(const CResourceFileException& aObject) |
|
116 { |
|
117 LERROR(L"Resource File Parsing Error - "); |
|
118 aObject.Display(); |
|
119 result = RSC_PARSING_ERROR; |
|
120 } |
|
121 #endif //SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
85 catch(const RomManagerException& e) |
122 catch(const RomManagerException& e) |
86 { |
123 { |
87 LERROR(L"ROM Manager Error - "); |
124 LERROR(L"ROM Manager Error - "); |
88 e.Display(); |
125 e.Display(); |
89 result = ROM_MANAGER; |
126 result = ROM_MANAGER; |
116 catch (...) |
153 catch (...) |
117 { |
154 { |
118 result = UNKNOWN_EXCEPTION; |
155 result = UNKNOWN_EXCEPTION; |
119 LERROR(L"Unknown Error" << std::endl); |
156 LERROR(L"Unknown Error" << std::endl); |
120 } |
157 } |
121 |
158 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
159 //Restore Database in case of installation error for SA over SA and PU case |
|
160 if(result != 0) |
|
161 { |
|
162 std::string BackupDb(dbpath); |
|
163 BackupDb.append("_backup"); |
|
164 if (FileExists(string2wstring(BackupDb))) |
|
165 { |
|
166 std::string command = "move " + BackupDb + " " + dbpath; |
|
167 int err = system(command.c_str()); |
|
168 if (err != 0) |
|
169 LERROR(L"Failed to Restore src.db "); |
|
170 } |
|
171 } |
|
172 #endif |
122 if (NULL != logFile) |
173 if (NULL != logFile) |
123 { |
174 { |
124 bool val = logFile->is_open(); |
175 bool val = logFile->is_open(); |
125 logFile->close(); |
176 logFile->close(); |
126 delete logFile; |
177 delete logFile; |
127 } |
178 } |
128 |
179 |
129 return result; |
180 return result; |
130 } |
181 } |