75 |
75 |
76 if (fileName.toLowerCase().endsWith(".oby") || fileName.toLowerCase().endsWith(".iby")) //$NON-NLS-1$ //$NON-NLS-2$ |
76 if (fileName.toLowerCase().endsWith(".oby") || fileName.toLowerCase().endsWith(".iby")) //$NON-NLS-1$ //$NON-NLS-2$ |
77 parseAndProcessObyFile(fileName); |
77 parseAndProcessObyFile(fileName); |
78 else if (fileName.toLowerCase().endsWith(".pkg")) //$NON-NLS-1$ |
78 else if (fileName.toLowerCase().endsWith(".pkg")) //$NON-NLS-1$ |
79 { |
79 { |
80 addFilesInPkg(fileName); |
80 addFilesInPkg(fileName, currentFile.epocRoot); |
81 } |
81 } |
82 else |
82 else |
83 { |
83 { |
84 GeneralMessages.showErrorMessage(Messages.getString("BinaryReader122.wrongEKA2FileType1")+fileName+Messages.getString("BinaryReader122.wrongEKA2FileType2")); //$NON-NLS-1$ //$NON-NLS-2$ |
84 GeneralMessages.showErrorMessage(Messages.getString("BinaryReader122.wrongEKA2FileType1")+fileName+Messages.getString("BinaryReader122.wrongEKA2FileType2")); //$NON-NLS-1$ //$NON-NLS-2$ |
85 } |
85 } |
118 public Binary getBinaryForHostName(String s) |
118 public Binary getBinaryForHostName(String s) |
119 { |
119 { |
120 return this.getHostNameToBinary().get(s); |
120 return this.getHostNameToBinary().get(s); |
121 } |
121 } |
122 |
122 |
123 public void addFilesInPkg(String pkgName) |
123 public void addFilesInPkg(String pkgName, String epocRoot) |
124 { |
124 { |
125 long lineNumber = 0; |
125 long lineNumber = 0; |
126 File pkgFile = new File(pkgName); |
126 File pkgFile = new File(pkgName); |
127 if (pkgFile.exists() && !pkgFile.isDirectory()) |
127 if (pkgFile.exists() && !pkgFile.isDirectory()) |
128 { |
128 { |
170 if (fourth != -1) |
170 if (fourth != -1) |
171 { |
171 { |
172 Binary binary = null; |
172 Binary binary = null; |
173 |
173 |
174 localFile = line.substring(first+1,second); |
174 localFile = line.substring(first+1,second); |
|
175 if(localFile.charAt(0) == '/'){ |
|
176 localFile = localFile.replace('/', '\\'); |
|
177 } |
175 String remoteFile = line.substring(third+3,fourth); |
178 String remoteFile = line.substring(third+3,fourth); |
176 |
179 |
177 // .PKG is referring everything as root relative, |
180 // .PKG is referring everything as root relative, |
178 // sometime there is reference to $(EPOCROOT) too |
181 // sometime there is reference to $(EPOCROOT) too |
179 // let's try to guess what it was. I hate windows drive letter |
182 // let's try to guess what it was. I hate windows drive letter |
180 if (localFile.charAt(0) == '\\') { |
183 if (localFile.charAt(0) == '\\') { |
181 localFile = GuessAndFixPath.fixPath(localFile, "", pkgName); //$NON-NLS-1$ |
184 if(epocRoot == null){ |
|
185 epocRoot = ""; |
|
186 } |
|
187 localFile = GuessAndFixPath.fixPath(localFile, epocRoot, pkgName); //$NON-NLS-1$ |
182 } else if (localFile.charAt(1) != ':') { |
188 } else if (localFile.charAt(1) != ':') { |
183 // not absolute drive, resolve relative to PKG file |
189 // not absolute drive, resolve relative to PKG file |
184 File relativeMapFile = new File(pkgFile.getParent(), localFile); |
190 File relativeMapFile = new File(pkgFile.getParent(), localFile); |
185 if (relativeMapFile.exists()) { |
191 if (relativeMapFile.exists()) { |
186 localFile = relativeMapFile.getCanonicalPath(); |
192 localFile = relativeMapFile.getCanonicalPath(); |
289 if (lineNumber > 0) { |
295 if (lineNumber > 0) { |
290 myMessage += Messages.getString("BinaryReader122.line.number") + lineNumber; //$NON-NLS-1$ |
296 myMessage += Messages.getString("BinaryReader122.line.number") + lineNumber; //$NON-NLS-1$ |
291 } |
297 } |
292 |
298 |
293 // if it is code binary... |
299 // if it is code binary... |
294 GeneralMessages.PiLog(myMessage, GeneralMessages.WARNING); |
300 GeneralMessages.piLog(myMessage, GeneralMessages.WARNING); |
295 } |
301 } |
296 } |
302 } |
297 } |
303 } |
298 else if (debug) { |
304 else if (debug) { |
299 System.out.print(fileSpecMatcher.group(1)); |
305 System.out.print(fileSpecMatcher.group(1)); |
308 ++lineNumber; |
314 ++lineNumber; |
309 } |
315 } |
310 } catch (EOFException e) { |
316 } catch (EOFException e) { |
311 // good, that's the end of file, bail out peacefully |
317 // good, that's the end of file, bail out peacefully |
312 } catch (IOException e) { |
318 } catch (IOException e) { |
313 GeneralMessages.PiLog(Messages.getString("BinaryReader122.IOException.on") + obyFile, GeneralMessages.ERROR, e); //$NON-NLS-1$ |
319 GeneralMessages.piLog(Messages.getString("BinaryReader122.IOException.on") + obyFile, GeneralMessages.ERROR, e); //$NON-NLS-1$ |
314 } |
320 } |
315 } |
321 } |
316 |
322 |
317 public void setHostNameToBinary(Hashtable<String, Binary> hostNameToBinary) { |
323 public void setHostNameToBinary(Hashtable<String, Binary> hostNameToBinary) { |
318 this.hostNameToBinary = hostNameToBinary; |
324 this.hostNameToBinary = hostNameToBinary; |