43 |
43 |
44 if (aIsSystemDrive) |
44 if (aIsSystemDrive) |
45 dbName = wstring2string(aDrivePath) + "\\sys\\install\\scr\\scr.db"; |
45 dbName = wstring2string(aDrivePath) + "\\sys\\install\\scr\\scr.db"; |
46 else |
46 else |
47 dbName = wstring2string(aDrivePath) + "\\sys\\install\\scr\\provisioned\\scr.db"; |
47 dbName = wstring2string(aDrivePath) + "\\sys\\install\\scr\\provisioned\\scr.db"; |
|
48 |
|
49 std::wstring wdbname(string2wstring(dbName)); |
|
50 //Create the SCR DB if not present in the System Drive |
|
51 if(!FileExists(wdbname)) |
|
52 { |
|
53 const char* epocRoot = getenv("EPOCROOT"); |
|
54 if(NULL == epocRoot) |
|
55 { |
|
56 std::string emsg(" EPOCROOT environment variable not specified."); |
|
57 int retCode = ExceptionCodes::EEnvNotSpecified; |
|
58 throw InterpretSisError(emsg,retCode); |
|
59 } |
|
60 std::string epocRootStr(epocRoot); |
|
61 |
|
62 #ifndef __TOOLS2_LINUX__ |
|
63 std::wstring swEnvInfo = string2wstring(epocRootStr) + L"epoc32\\tools\\create_db.xml"; |
|
64 #else |
|
65 std::wstring swEnvInfo = string2wstring(epocRootStr) + L"epoc32/tools/create_db.xml"; |
|
66 #endif |
|
67 |
|
68 if(FileExists(swEnvInfo)) |
|
69 { |
|
70 std::string executable = "scrtool.exe"; |
|
71 std::string command; |
|
72 |
|
73 command = executable + " -c " + dbName + " -f " + wstring2string(swEnvInfo); |
|
74 |
|
75 std::cout << "Creating DB : " << command << std::endl; |
|
76 |
|
77 int error = system(command.c_str()); |
|
78 if(error != 0) |
|
79 { |
|
80 std::string err = "Scrtool failed to create the database."; |
|
81 throw InterpretSisError(err, DATABASE_UPDATE_FAILED); |
|
82 } |
|
83 } |
|
84 else |
|
85 { |
|
86 LERROR(L"Failed to create the database."); |
|
87 std::string emessage(" XML file /epoc32/tools/create_db.xml which contains software environment information is not found."); |
|
88 int returnCode = ExceptionCodes::EFileNotPresent; |
|
89 throw InterpretSisError(emessage,returnCode); |
|
90 } |
|
91 } |
48 |
92 |
49 try |
93 try |
50 { |
94 { |
51 iScrDbHandler = new CDbProcessor(dllName, dbName); |
95 iScrDbHandler = new CDbProcessor(dllName, dbName); |
52 } |
96 } |