/** * Writes the location of a trace * * @param files file references * @param trace trace to be written */ private void writeLocation(ArrayList<DictionaryFileRef> files, Trace trace) { LocationProperties loc = findFirstLocation(trace); if (loc != null) { String path = loc.getFilePath(); String file = loc.getFileName(); if (path != null) { path = FileUtils.convertSeparators(SourceConstants.FORWARD_SLASH_CHAR, path, true); // TODO: Remove drive letter. Actually cannot remove drive // letter because EPOCROOT might not be in the root of the drive } DictionaryFileRef ref = getRef(files, file, path); if (ref == null) { ref = new DictionaryFileRef(file, path, trace); files.add(ref); trace.addExtension(ref); } else { trace.addExtension(ref); } } }
/** Writes the dictionary file */ void write() { defref = 0; fileref = 0; File file = new File(dictionaryFile.getAbsolutePathWithID()); // Delete removes possible read-only flags if (file.exists()) { file.delete(); } TraceDictionaryEncoder encoder = new TraceDictionaryEncoder(); File path = file.getParentFile(); if (!path.exists()) { FileUtils.createDirectories(path); } encoder.createNewDictionary(file.getAbsolutePath()); Dictionary.startDictionary(); createTypedefs(); createDefs(); createLocations(); createComponent(); Dictionary.endDictionary(); }